View Full Version : cgi-bin prob
ploppy
07-20-2005, 05:39 PM
Hi. whatever cgi or pl scripts within my bin do not run. i have tried a simple script such as the hello world script but just keep getting:
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: hello.pl
if i run perl -w hello.pl from telnet outputs correctly but not from the web. I have tried permissions: 700/755/777 but still no output. Any ideas?
joeframbach
07-20-2005, 06:07 PM
put this at the top of the page:
print "Content-type: text/html\n\n";
ploppy
07-20-2005, 06:16 PM
hi joe. thx 4 reply. at the top of what page?
ploppy
07-20-2005, 06:17 PM
this is the code:
#!/usr/bin/perl
# hello.pl
print ("hello World!/n");
Are you sure that the shebang line is the correct one for the server you're running on? if so, I would put this:
print "Hello World";
and see what happens if anything :)
Bazz
ploppy
07-20-2005, 07:06 PM
baz. this is the simple piece of code:
#!/usr/bin/perl
# hello.pl
print "Content-type: text/plain\n\n";
print 'Hello World!';
that should run from bin. nothing runs at all from bin. what am i missing here?
ploppy
07-20-2005, 07:07 PM
also, what is a 'shebang'?
joeframbach
07-20-2005, 11:40 PM
in musical notation, # is "sharp."
in the history of geekdom, "!" is pronounced "bang." (see also "cokebottle").
therefore, #! = shebang.
mlseim
07-21-2005, 04:07 AM
Are you putting the script in your "cgi-bin" directory?
You mentioned before something about "bin". That should be "cgi-bin".
#!/usr/bin/perl
# hello.pl
print "Content-type: text/plain\n\n";
print "Hello World!";
Make sure the "shebang" is on the top line.
Ask your webhost what the "shebang" should look like.
You probably are already doing these things? ...
Upload the Perl script in ASCII mode (not binary, like graphic files).
CHMOD the script to 755.
Then you call your script to run like this (as an example):
http://www.mysite.com/cgi-bin/hello.pl
ploppy
07-21-2005, 04:26 PM
hi. done all those things. the funny thing is that nothing is runniing from the cgi-bin. not just this script. what should the default permissios be for the cgi-bin? thx
joeframbach
07-21-2005, 07:07 PM
you may need to change your httpd.conf file. add this line.
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"
but change the location to your cgi-bin folder.
ploppy
07-22-2005, 12:11 AM
this is what is in the httpd.conf file on my unix server:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
then this line:
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
order allow,deny
allow from all
allow from all
</Directory>
shed any light?
joeframbach
07-22-2005, 04:07 PM
is hello.pl in /var/www/cgi-bin?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.