Knowledgebase: Cpanel Control Panel > CGI
How to solve "500 Internal Server Error" with cgi/Perl scripts
Posted by - NA - on 14 March 2010 04:37 PM
In our servers, CGI/Perl is enabled for all accounts. However, if these files need direct access, then those are to be placed in the folder named 'cgi-bin'.

If you get any Internal server error, that can be due to various factors. Please check the steps one by one and  that will help you to solve the errors.

1.  Check the Directory permissions.

Your cgi-bin directory should be chmodded as 0755, not 0777 or 0700.  Similarly if your script is at .../cgi-bin/foo/bar.cgi, the foo directory must not be world-writable (0777).  This is because many servers will refuse to execute CGI scripts within world-writable directories, as a security precaution.

2. Check the File Permissions.

Your CGI script itself must also be 0755 and not 0777, for the same reasons.

3. Check the  File Transfer mode in your FTP client, if the script is giving unexpected errors.

If you are using FTP to transfer the CGI script to your server, then your FTP client is probably set to AUTO transfer mode; that is, it will try to figure out whether to use BINARY or ASCII mode without asking you.  But depending on whether your CGI script came from a Windows or UNIX system, and whether it's going to a Windows or UNIX system, you may need to manually set your FTP client to use either ASCII or BINARY mode before transferring your CGI script.  Try one and then the other.

(720 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).