PDA

View Full Version : CGI Problem


galton
07-21-2000, 03:21 PM
My Perl scripts run from the command line, but when called with a URL, fail with the message premature end of script headers.

URL: cgi.dreamscape.com/galton/cgi-bin/environment.cgi

I left this simple script in the directory to simplify troubleshooting.

#/usr/bin/perl

print "Content-type: text/html\n\n";
print "<html><head><title>Environment Display</title>";
print "</head><body>";
print "<h1>Environment Variables</h1>";
print "The following variables are present in the current environment:";
print "<ul>";
while (($key, $value) = each %ENV) {
print "<li>$key = $value\n";
}
print "</ul>";
print "End of environment";
print "</body></html>";

What's happening here?

Thank you,

WW
07-31-2000, 10:34 PM
your script works fine: try adding an exclaimation point to the shebang as follows:

Original: #/usr/bin/perl
Edited: #!/usr/bin/perl

other than that, you're good to go!
hope that helps,
WW

Jason
08-01-2000, 01:50 AM
Hi WW,

Thanks for helping out on our forums http://talkboard.123webmaster.com/ubbhtml/biggrin.gif What's your name, and what's your game? http://talkboard.123webmaster.com/ubbhtml/wink.gif

------------------
Jason M. DesRoches
Co-Founder / Business Development
Big Resources Network
jason@123webmaster.com
ICQ: 17947522