5 common problems when hosting a CGI-BIN (Perl) script!
1) MS-style new lines
IfÃ‚Â you are using MS Windows (DOS style) to write/edit your scripts, make sure that the scripts new lines are free from nr (CR+LF) we are a Linux (Unix) host, and each new line should end only with n (LF).
Generally, using a text editor is the simplest and most convenient way of converting a text file between different new line formats; most modern editors can read and write files using at least the different ASCII CR/LF conventions. Unfortunately, the standard Windows editor Notepad is not one of them, though Wordpad is.
In addition, you can use the following tools to convert your files before uploading to our service from CR+LF to LF-only new lines.
Command line tool:
For example, if you want to execute cgi from the /var/www/html/cgi directory, just create and upload the .htaccess file in the /var/www/html/cgi directory. Below, you will see how the .htaccess file must appear:
AddHandler cgi-script .cgi
For more information about apache configuration directives, please visit:
2) Incorrect Perl path
Most of the freely available scripts use incorrect paths to the Perl interpreter. The interpreter path is the first line of each CGI (Perl) script. You need to make sure that the path to the Perl interpreter is as follows:
/usr/local/bin/perl or anything other than the above.
3) Incorrect file permissions
When you upload your files, make sure that your file permissions are not set to 777 (read/write/execute for everyone) the file permissions needs to be different than 777; for example, 755. Also, the owner of the file needs to be the domain owner user.
4) Incorrect Send Mail path
Most of the freely available scripts use sendmail for mail delivery However, the sendmail path might be setup incorrectly. The sendmail path needs to be as follows:
/usr/bin/sendmail.sendmail or different than the above
5) Executing a CGI script from a directory different than cgi-bin
The default option for the Apache web server is that you can execute CGI scripts only from your CGI directory:
If you are trying to execute a cgi script from a different directory; for example, /var/www/html/cgi, you need to let the Apache server know that.
You can do that with the use of .htaccess files.