Premature End? Whats that?

Started by
3 comments, last by cyanide 23 years, 2 months ago
Hi, i recently installed Apache on linux system and whenever i run a script i keep getting an error that says internal error 505 in netscape. On viewing the error log the error log states something like: Error(2): No such file /cgi-bin/test.pl and premature end of script. BTW the test.pl i wanted to run is: #!/usr/bin/perl print "Content-type: text/html\n\n"; print "Hello World!"; I''ve tried changing the #!/usr/bin/perl to #!/usr/local/bin/perl, but it won''t help. whats wrong? please can u help me? cyanide. p.s. i''ve chmod every file in the cgi-bin dir to 755 by using: chmod 755 *
[size="1"]----#!/usr/bin/perlprint length "The answer to life,universe and everything";
Advertisement
Put test.pl into cgi-bin directory else you will get a file not found error - unless you modified apache.
Hello from my world
it is in the cgi-bin dir and i''ve edited apache''s httpd.conf ScriptAlias tag for the correct directory with the following permissions given:

AllowOverride None
Options None
Order allow,deny
Allow from all


hmm still no luck

cyanide.
[size="1"]----#!/usr/bin/perlprint length "The answer to life,universe and everything";
Some things to check:

First, the cgi-bin directory is normally _not_ a subdirectory of the document directory but instead someplace else (it's specified in access.conf I think).

Second, the files must be readable for the user apache is running as. This includes the directory it is stored in. I don't know whether it has to be executable in order to be called from apache, but I'd suggest so.

Third, make sure you have mod_perl or an appropriate apache module running. There also seems to be an apache derivate with perl interpreter included.

Fourth, check the path of your perl interpreter. This is done by executing the command "which perl" at the command line. The first line must match that path.

Oh, another thing: if you intend to write CGI scripts, think about using the CGI module for perl. It handles stuff like parameter passing nicely and offers you a simplified way of building pages. You can find info about it at www.perl.com.

Edited by - Shadowdancer on January 31, 2001 11:19:31 AM
the version of apache though did not have anything in access.conf but yeah! you were kinda right about the mod_perl thing. I dunno why but it was commented out from the httpd.conf by default. Uncommenting it have made things smooth now!

whoa! thanks dude, finally got it!

cyanide.
[size="1"]----#!/usr/bin/perlprint length "The answer to life,universe and everything";

This topic is closed to new replies.

Advertisement