Website hosting solutions from Graphicjunkie.com
UK Hosting Packages UK Web Hosting Features Ready Made Website Templates About Graphicjunkie Hosting Support Knowledgebase Contact Us Graphicjunkie Recommends Control Panel Login
 
Main » Perl
Perl
ANSWERS
  1. Are there a list of steps for debugging my Perl script>
    Below is a list of steps to go through to troubleshoot any problematic Perl scripts.

    1. Gather Information about the Problem
    If the output indicates a syntax error with the Perl script. The problem has been identified as a problem with the code in the Perl script.
    If the error "Command not found." is returned at the prompt, do the following:

    1. Check the permissions on the actual Perl script. Must be executable.
    2. Retry. If it still fails, then check the permissions on all directories leading up to the Perl Script. They must be set to rwxr-xr-x, or CHMOD 755.
    If the script will execute (possibly return HTML output) through Telnet, but still gets an "Internal Server Error" through the web, do the following:

    1. Ensure that the file permissions are set to rwxr-xr-x, or chmod 755.
    2. Ensure that the file permissions are not set to rwxrwxrwx, or chmod 777.
    At this point, you must know the source of the problem, whether it be a permissions problem or a syntax error within the Perl code itself. Now all you must do is fix it :)

    [Back to top]
  2. Can I use a "cgi-bin" on my account for my Perl scripts?
    Yes. In fact, a cgi-bin is already configured for you in the "/home/username/public_html/cgi-bin/" directory. This is the only location where cgi scripts will execute
    [Back to top]
  3. Do my Apache error_logs contain any useful information?
    It depends. When a Perl script encounters an "Internal Server Error" for whatever reason or a "Forbidden" message when executed via the web, useful information is logged to your error_log, located in your logs directory.

    When you execute Perl scripts through the command line, any errors encountered are not logged to this file. The usefulness of this file applies only to the execution of Perl scripts through the web.

    [Back to top]
  4. Do my Perl scripts have to reside in a certain directory, such as the "cgi-bin"?
    Yes. This is the ONLY location where cgi scripts will execute. Place all of your cgi scripts in the "/home/username/public_html/cgi-bin" directory.
    [Back to top]
  5. Do you frequently upgrade Perl with new build releases?
    Yes. Once a new build of Perl has been deemed as stable versus experimental, We will promptly upgrade to this version of Perl.

    We are currently running version 5.006001 (as of the 21st August 2003).

    [Back to top]
  6. How should I set my file permissions on a Perl script?
    Often permissions are set very leniently in order to avoid any permissions problem. This is not a good idea. Your Perl scripts should have the appropriate permissions depending on the function of that particular script.

    First, all scripts should be set to the owner (you) having read, write and execute privilege (rwx) regardless of the function of the Perl script.

    Next, you should ask yourself if you want people (visitors) to your website to be able to execute the Perl script. This is most likely the case. Under these conditions, your script would be set to world readable and executable (r-x). Do not give the world write permission on the Perl script! It is not necessary and may lead to problems!

    If your script is not going to be executed through the web and only you will be executing the script through Telnet (there are various reasons for having a script operate under these conditions), then you set the script to no world permissions (---).

    The group permissions should be set to read and executable (r-x) if the script is to be executable via the web. Otherwise, set your group permissions to nothing (---). With this information, you have the following permissions breakdown:

    Executed via the web by anyone: chmod 755
    Executed by only yourself through the command line: 700

    Often a Perl script will open a file for writing. This is the case in guestbooks and bulletin boards, where the information is received from the form and written to a certain file. The permissions of this particular file are now important.

    Many times, the author of a Perl script you use on your account will require you to set this file to rwxrw-rw-, or chmod 766, which allows write access to the world. This is not a good idea and is unnecessary.

    Files that need to be written to by way of a Perl script can be set to the default permissions of rw-r--r--, or chmod 644. This will work fine with our setup.

    Finally, never set your file permissions to rwxrwxrwx, or chmod 777. This is not necessary, may cause a security problem on your website, and will cause your Perl script to not execute at all.

    [Back to top]
  7. Should I upload my Perl scripts in ASCII or Binary mode?
    You should always upload your Perl scripts in ASCII mode via FTP. If you upload your scripts in binary mode, the scripts will not work and you will get an "Internal Server Error: Premature End of Script Headers" error (500 Internal Server Error). It is very important to remember to only upload your Perl scripts in ASCII mode.
    [Back to top]
  8. What are the absolute paths to Perl?
    Below are all of the current absolute paths to Perl on all of our servers:

    /usr/bin/perl

    [Back to top]
  9. What are the correct file extensions for Perl scripts?
    Your Perl scripts can have the extension .pl or .cgi. However, Perl scripts that are going to produce output to the web (world readable) would use the extension .cgi. Perl scripts that are only meant to be executed by yourself via the command line or even scripts which may be executed through the web without any output should be set to the .pl file extension.
    [Back to top]
Jump to:
Powered by ODFaq v2.1.0
 
-
Website © 2003-2008 Graphicjunkie Hosting | UK Webhosting by Graphicjunkie Hosting | Site Map
-