Running CGI script from any directory
In order to force apache to allow cgi script to run, simply create a file called .htaccess inside the directory in which you wish to run the scripts. Insert the following text into the .htaccess file:
Options +ExecCGI
AddHandler cgi-script .cgi .pl
Internal Server Error with cgi files
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.
2) The file needs to be in a cgi-bin and must have the owner/group as the username who owns the site.
3) The script must have execute permission.
4) The most common chmod permission is 755.
5) The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt.
6) Other errors that would be generated when running the script manually from ssh would be missing perl modules.
7) Cpan is the easiest method to install new perl modules, eg:
perl -e shell -MCPAN
install Bundle::DBD::mysql