PDA

View Full Version : basic perl cgi-bin question


Ryuuguu
07-04-2005, 12:05 AM
I get "500 Internal Server Error" on perl script.
the script is
print "line 1 <BR>";
I have placed it in my /cgi-gin on FQ.
I checked the premissions on it and changed them to 755 (orginally 644 which also didn't work).
file is called stack1.pl
trying to access by
http://www.ryuuguu.com/cgi-bin/stack1.pl

Cheers,
Grant

Terra
07-04-2005, 12:10 AM
You are missing the 'she-bang' line, that tells Linux what interpreter to process your script through...

Add this to the top:
#!/usr/bin/perl -Tw
use strict;

--
Terra
--might as well start them off on the right foot--
FutureQuest

sheila
07-04-2005, 12:13 AM
You also need to always include this in your CGI scripts:

print "Content-type: text/html\n\n";

before printing any other content.

Here is a minimal CGI script that does what you want:

#!/usr/bin/perl -Tw
use strict;

print "Content-type: text/html\n\n";

print "line 1 <BR>";