[Asterisk-Users] Help Running am-main.pl Perl/CGI on Apache Server

Shekhar Prasad shekhar.prasad at gmail.com
Sun Sep 5 16:29:43 MST 2004


Just tried it and no luck here.  Here's a copy of the script if you
want to go into details (note, I am having the same problem for all
scripts that came with Asterisk Manager.  The error I get when trying
to execute in browser is: Server Error 500 - Premature end of script
header)  I've spent 3-4 hours researching the web and trying different
things to fix it.

#!/usr/bin/perl
# Comments #
use CGI; #already included with the file
use am_common;
my $q = CGI->new(); #additions just mentioned by Jim
print $q->header(); #additions just mentioned by Jim
$CGI::POST_MAX = 512 * 1024;    # half meg is max size
$pvars = CGI::new();
                                                                                
# get directories if passed in otherwise get them from the .cfg file
my $dir_work = $pvars->param("DIRW");
my $dir_conf = $pvars->param("DIRC");
my $dir_ast = $pvars->param("DIRA");
if (!$dir_work)
{
    $dir_work = get_cfg_value("dir_work");
}
if (!$dir_conf)
{
    $dir_conf = get_cfg_value("dir_conf");
}
if (!$dir_ast)
{
    $dir_ast = get_cfg_value("dir_ast");
}
my $page = "Content-type: text/html\n\n";
$page .= "<HTML><HEAD><TITLE>Asterisk Management System</TITLE></HEAD><BODY>";
$page .= "<FONT SIZE=-1><B><A
HREF=\"am-help.pl?DIRW=$dir_work&DIRC=$dir_conf&DIRA=$dir_ast&HT=help-main\">HELP</A></B>";
$page .= "<CENTER><FONT SIZE=+3><B>Asterisk Management System</B></FONT><BR>";
$page .= "<HR>";
$page .= "<BR><A
HREF=\"config.pl?DIRW=$dir_work&DIRC=$dir_conf&DIRA=$dir_ast\">Configuration</A>";
$page .= "<BR><A
HREF=\"admin.pl?DIRW=$dir_work&DIRC=$dir_conf&DIRA=$dir_ast\">Administration</A></CENTER>";
$page .= "</BODY></HTML>";
print $page;
exit(0);


Any help will be greatly appreciated.

Sincerely,
Shekhar Prasad

On Sat, 4 Sep 2004 15:35:48 -0400, Shilliday, Jim
<jshilliday at ejcenter.org> wrote:
> I had the same problem -- make sure these three lines are at the
> beginning of each of your .pl's (right after the comment section):
> 
> use CGI;
> my $q = CGI->new();
> print $q->header();
> 
> That fixed it for me.
> 
> Jim Shilliday
> IT Director
> Equal Justice Center
> 1315 Walnut St. Suite 400
> Philadelphia PA 19107
> 215-238-6970
> 
> 
> 
> 
> -----Original Message-----
> From: Shekhar Prasad [mailto:shekhar.prasad at gmail.com]
> Sent: Saturday, September 04, 2004 2:19 PM
> To: asterisk-users at lists.digium.com
> Cc: Taemoor Abbasi
> Subject: [Asterisk-Users] Help Running am-main.pl Perl/CGI on Apache
> Server
> 
> Hi all,
> 
> I've installed Asterisk on Linux Red Had 9.  Now, I was trying to set
> up a GUI based system for the PBX.
> I downloaded some packages, but I have to have Perl running CGI
> scripts through the webserver.  It does not allow me to.
> I am able to run a basic script that just just prints out html
> messages and nothing else.  However, when I try to run am-main.pl or
> config.pl or any other cgi-bin scripts that came with Asterisk, I get
> a 500 error: Premature End of Script Header.  I've tried changing the
> chmod to -x or 755 and also have included the header required to
> display the html script.  However, no luck.  I am able to run it in
> command line, but not through the Mozilla browser.
> 
> Is this enough information I've provided?  You can contact me directly
> if you need more information.
> shekhar . prasad at gmail . com
> 
> shekhar
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list