Troubleshooting CGI/PERL scripts


  • Applies to: Grid
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: SSH, vi knowledge
  • Applies to: All DV
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: SSH, vi knowledge

Overview

This article provides some basic troubleshooting steps to follow for CGI and Perl scripts.

This article is provided as a courtesy. (mt) Media Temple is in no way responsible for troubleshooting your scripts. If, after reviewing these tips, you continue to have problems with your script, we respectfully request that you contact the script's author for support.

Requirements

Most of the troubleshooting steps described here require SSH access to your server. Please see the following article for assistance with SSH:

READ ME FIRST

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.

READ ME FIRST

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.

Troubleshooting Tips

Paths

Executable scripts should be in your cgi-bin by default and for security.

Make sure that all modules and include files required by your script have been uploaded to the server and are in the locations called by the script.

Ownership and permissions

Your script, and any files it includes, must be owned by the administrative user for the domain that uses it. If you uploaded the script using FTP, it probably has the correct ownership already. However if, for example, you extracted the script from a backup made on another server, it may have the wrong ownership. Here is the correct ownership and group for your files:

  • serveradmin:serveradmin
  • domainuser:psaserv for your "cgi-bin" directory; domainuser:psacln for your script, as well as any included files in your httpdocs directory

Use the chown command to change the permissions on your files. Example:

chown serveradmin:serveradmin myscript.pl
chown domainuser:psaserv myscript.pl

If your script belongs to the wrong owner and you receive a "permission denied" error after running the above command, you will need to open a support request in your AccountCenter.

Your script must be executable. 700 permissions are generally recommended in this case. The domain user, at least, must have execute permissions.

chmod 700 myscript.pl

Your script and any files it uses must NOT be group or world writeable; e.g. 777 permissions are NOT recommended.

Permissions for the cgi-bin MUST be 755. Here is an example for setting permissions to 755 on the Grid (replace 00000 with your site number and example.com with your domain):

chmod 755 /home/00000/domains/example.com/cgi-bin/

Permissions for the cgi-bin MUST be 755. Here is an example for setting permissions to 755 on the DV server (replace example.com with your own domain name):

chmod 755 /var/www/vhosts/example.com/cgi-bin/

Make sure CGI and Perl support are enabled for your domain. For detailed instructions, please see: DV How do I enable FastCGI?