Effective solutions for 500 Error, Premature end of script headers
The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the web server. Here are common solutions.
SuPHP Symlink
suPHP module was attempting to run php5 on the server, unfortunately php5 was a symlink to the php-cli executable and not the php-cgi executable as it was expecting. The fix was simple in the end, issue the following command:
ln -s /usr/local/php /usr/local/php5
Interference with an .htaccess file
If you have implemented .htaccess on your site, it may be interfering with the web page you are trying to load into your browser. Please double check the .htaccess configurations to ensure that it doesn't contain any errors. To confirm whether a misconfigured .htaccess is the cause of the 500 Internal Server error, either remove or rename the .htaccess file.
PHP Coding Timing Out
If your php script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause the Internal Server Error. To prevent such time outs and errors, we suggest that your relevant php scripts be coded with some timeout rules.
Syntax or coding errors in your CGI/Perl script
CGI Script Guidelines:
- When editing your CGI script, use a program that saves the file as a 'text file' type. DO NOT use Wordpad.
- Upload your CGI scripts in ASCII mode into the cgi-bin directory.
- Set the file permissions on the CGI script file and directories to be 'chmod 755.'
Incorrect file permissions
If the file permissions of your scripts are not set correctly, it can cause the 500 Internal Server Error. Set file permissions using:
chmod 755 script.cgi
Limiting CPU usage
For issues related to CPU limits causing errors, see: cPanel Forums: Limit Accounts CPU
Reference: enternauta.com.br — Premature end of script headers