Debugging Perl Script Installations
If you’ve ever installed a CGI script on your own server then you’ve no doubt encountered the dreaded Internal Server 500 Error — also known as the kiss of death! TDavid offers up ten tips for beating this messenger of doom.If you’ve ever installed a CGI script on your own server then you’ve no doubt encountered the dreaded Internal Server 500 Error — also known as the kiss of death! TDavid offers up ten tips for beating this messenger of doom.
With this article I’m going to give you a list of 10 handy tips for debugging Perl CGI installations. I usually follow somewhat along this course when I get that blasted “internal server 500 error” message:
1. Check for missing or omitted quotes in a variable assignment.
WRONG: $variable = “value;RIGHT: $variable = “value”;
2. Are emails backslashed in interpreted quotes? Or did you use literal quoting?
WRONG: $email = “myemail@myisp.com”;RIGHT: $email = ‘myemail@myisp.com’;RIGHT: $email = “myemail\@myisp.com”;
3. Is the path to perl correct?
WRONG: #/usr/local/perlRIGHT: #!/usr/bin/perlRIGHT: #!/usr/local/bin/perlRIGHT: #!/usr/bin/perl5
4. Did you upload all script source files in ASCII mode?
WRONG: uploaded in BINARY modeRIGHT: do not use “auto” setting, use manual ASCII mode in your FTP program
5. Do you have the permissions set correctly the way the readme.txt or other instructions say?
6. Do you have URLs and PATHS properly defined where it requests them?
WRONG PATH: http://www.tdscripts.com/RIGHT PATH: /home/usr/tdavid/tdscripts/
WRONG URL: /home/usr/tdavid/scriptschoolRIGHT URL: http://www.scriptschool.com/
7. Is the syntax of the script correct using telnet? Login with telnet and type:
perl -c SCRIPTNAME.CGI
8. Is the path to sendmail correct? Check with your host to get the right path, but the common one is:
/usr/sbin/sendmail
\’. Are all the libraries you need installed on the server? Try commenting out the libwww or other require library calls and see if the script runs. If it does, then probably you don’t have this library on the server and you need to have your host add it. Or you may need to add it yourself if it is a dedicated server.
10. Is the syntax is okay and it still won’t execute… and you’ve tried everything else above? Then try deleting the file off the server and then reuploading (in ASCII, remember) and resetting the permissions. This one I can’t explain why it will sometimes work (caching maybe?) but it sometimes will when all else fails!