TechTutorials - Free Computer Tutorials  







Troubleshooting Perl Scripts For Beginners 
 


Added: 01/05/2004, Hits: 3,891, Rating: 0, Comments: 0, Votes: 0
Add To Favorites | Comment on this article
Installing Perl scripts can be a daunting task for the beginner, however, the good news is that the majority of problems are caused by 4 common oversights - FTP mode, permissions, Perl location and configuration parameters. Usually, these mistakes will result in an "Internal Server Error" when trying to access the script via http. If you are getting Internal Server Errors, use the following steps to troubleshoot. Note that this tutorial assumes that you are using a Linux/Unix/BSD web server.

1) Make sure you upload your script files in ASCII mode unless otherwise specified.

2) Check the permissions of the files and make sure that they are set to the appropriate level. If you are unsure as to which permissions are required for your scripts, check with the company or person that authored it. You can also try setting the permissions of all files used by the scripts to 0777. If that fixes the problem, then you know that the Internal Server Errors are permissions related.

3) Check the location of Perl in the scripts. At the top of your .cgi or .pl files you should see #!/usr/bin/perl or some other path to Perl. If you access your web server via Telnet or SSH, you should be able to type "which perl" to find the location of Perl on your server. Make sure that the path shown at the beginning of your Perl files matches the location on your server. If you are still unsure, check with your web host.

4) Check the configuration of your scripts. Most scripts will have parameters that need to be defined by you in order to work properly. These parameters may be in a separate config file or in the Perl scripts themselves (check your documentation for more info). These parameters will contain important configuration information such as server paths and URLs that are specific to your installation of the script. If you do not define these properly, your scripts probably won't work. If you are unsure about server paths and other parameters, check with your web host.

Don't just check these things once! Double and triple-check them to make sure that they are correct.

If you are still having problems, then we need to get some more information to find out what is going on. To do this, you will need to have Telnet or SSH access to your server. After logging in, change directories to the location of the Perl script that is causing problems and type the following command: perl -w yourscript.cgi where yourscript is the name of your Perl script. The -w switch tells Perl to report warnings and errors. If you receive warning messages, you should look them up on Google and see if you can find any others that have had similar problems and/or use the resources provided by the software developer (i.e. forums, support, documentation). Keep in mind that warnings usually will not prevent your scripts from running properly, so you are looking for fatal errors.

Another place to look for errors is in your servers error logs. Check with your web host to get access and find out where these are located.





Comments (0)

Be the first to comment on this article


Related Items








7 Seconds Resources, Inc.




IT Showcase