Our Virtual Private Servers are unique because they provide you with all of the flexibility, power, and control of a Dedicated Server. Because of this, you are free to customize and configure your Virtual Private Server for your specific circumstance and needs. This includes the ability to install your own custom developed CGI scripts or those that you have downloaded from a third party source.

In order for a CGI script to work properly, the script, as well as any files it needs to use, must have the correct permissions and ownership. All scripts must have execute permissions turned on for the owner, and should be owned by the same owner and group as the directory they are in, and as the Web server expects.For the main host, this is the www user and group, and for subhosts it is the User and Group indicated in the VirtualHost directives in the apache configuration file (/usr/local/apache/conf/httpd.conf).

Common Problems with Perl Scripts

  1. Failure to upload the Perl script in ASCII mode. Perl scripts, unlike compiled executables, are plain text files. Plain text files should be transferred from your local computer to your Virtual Private Server using ASCII mode (not BINARY mode). Failure to transfer your Perl scripts to your Virtual Private Server in ASCII mode may result in 500 Server Errors.

  2. Improper path specification of Perl interpreter. The first line of a Perl script indicates the path name of the Perl interpreter. In the Virtual Private Server environment, the correct specification of your Perl 5 interpreter is /usr/bin/perl. If you downloaded a Perl script from a third party source, the Perl interpreter is most often defined based on the author's host environment which may be different from the Virtual Private Server environment (/usr/bin/perl is fairly common however).

  3. Wrong File Permissions/Ownership. The Apache Web server requires read and execute permissions for user, group, and world to be turned on. Additionally, the scripts and the directory they are in must be owned by either www or the user and group indicated in the httpd.conf file.

Troubleshooting 500 Server Errors

If you encounter a 500 Server Error when you execute your scripts, the best way to diagnose the actual source of the problem is to examine your web server's error log. Your error log is typically stored in your /www/logs directory under the name error_log.

To review the server error generated in real time, perform the following steps, after connecting to your Virtual Private Server via SSH and su to root:

  1. Type this command:

    # tail -f /www/logs/error_log

    The tail command displays the last part of error_log file and will print anything appended to the error_log file to your console window. This in effect give you a real-time view of what is being written to your error log file.

  2. Using your browser, attempt to execute your CGI script again. When you do this, the actual error message will be displayed in your Telnet session.

    Common CGI Errors and Solutions

    • HTTPd/CGI: exec of [CGI PATH INFO] failed, errno is 2

      The first line of your CGI script failed to specify the correct location of the interpreter. If your script is written in Perl, please see the Common Problems with Perl Scripts section above for the proper first line definition of the Perl interpreter. If your Perl interpreter definition is correct, it is very likely that you uploaded the script in BINARY mode from your PC to your Virtual Private Server. If you originally uploaded the script in BINARY mode, re-upload the script in ASCII mode to correct the problem.

    • HTTPd: malformed header from script [CGI PATH INFO]

      Your script is not printing out a proper header response. When a CGI is executed, it communicates back to the web server a message which is divided into two parts: the header and the body. The header typically tells the web server the content type of the data that will be sent as the body of the response. The header and body are separated by a single blank line. An example of a CGI response is shown below:

      Content-type: text/html
      <body bgcolor="white">
      Hello world!

      The malformed header from script error message indicates that your script is not properly returning the header portion of the response. You may have misspelled Content-type, not supplied a valid type (such as text/html), or failed to print out a blank line to separate the header from body of the response.

Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!

1555 N Naperville/Wheaton Road, Suite 107
Naperville, IL 60563
phone 630.420.2550
fax 630.420.2771