cgi files generate Internal Server Error
by admin on Aug.11, 2011, under DirectAdmin
This means that the cgi script did not execute properly. There are several causes that can generate this error so a few things would need to be checked.
1) check the /var/log/httpd/suexec_log. It contains any errors that would be as a result of not having correct permissions on the file. The file needs to be in a cgi-bin and must have the owner/group as the username who owns the site. If it’s owned by anyone else, it will not run. Also, the script must have execute permission. The most common chmod permission is 755. Go through all directories from the public_html down to the directory the script is in, and make sure they’re all set to 755 (public_html can be 750 *only* if it has a group of apache).
If the suexec_log only shows the script being run, then the cause may be with the script code itself. The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt.
cd /home/username/domains/domain.com/public_html/cgi-bin
./script.cgi
One common error is to use an incorrect interpreter. The 2 most common interpreters are:
#!/usr/bin/perl
and
#!/usr/local/bin/php
This code must appear on the first line of the script. Sometimes a file is uploaded in windows format so the trailing newline (return) character is formed incorrectly and the file would need to be re uploaded in a different format.
Other errors that would be generated when running the script manually from ssh would be missing perl modules, in which case you’ll need to install them yourself. Cpan is the easiest method to install new perl modules, e.g.:
perl -e shell -MCPAN
install Bundle::DBD::mysql
Incoming search terms:
how to run cgi fileRelated posts:
- Hotlink protection: How-To prevent people from stealing your files Create an .htaccess file in your public_html directory with the...
- mod_ssl: Init: Failed to generate temporary 512 bit RSA private key This error appears to show up sometimes when using MySQL...
- Showing files in a directory If you want to list all files in a directory...
- Error: Cannot find SSL binaries under /usr This happens with the configure script for apache cannot find...
- I want apache 2.0, php 5 and mysql 5 DirectAdmin essentially will work with any version of the software...
Related posts brought to you by Yet Another Related Posts Plugin.
