A common error seen, however rarely known or understood is the "headers already sent" error. Which may look similar to this:
Premature end of script headers: /home/user/public_html/index.php
Premature end of script headers "actually means", the script stopped for whatever reason before it returned any output to the web server. This can be an extremely difficult error to diagnose.
Some suggested areas to consider or debug for the loathed 'Premature end of script headers':
Have you upgraded or downgraded your version of PHP recently? It is possible that your websites code/core functionality is not compatible with the version of PHP you've changed to.
If your website/program uses the require_once() function, it specifically requires a file at a certain location. If you've changed/renamed/moved files or folders recently, this could be the casue of your issue. Also, one of the easiest fixes I might add.
The RLimitCPU and RLimitMEM directives in the httpd.conf may also be responsible for the error if a script was killed due to a resource limit. Check your httpd configuration file (
/usr/local/apache/conf/httpd.conf ) for any
RLimitMEM settings and adjust them accordingly.
A configuration problem in suEXEC, mod_perl, or another third party module can often interfere with the execution of scripts and cause the error. If these are the cause, additional information relating to specifics will be found in the apache error_log.
If suPHP’s log reaches 2GB in size or larger you may see the premature end of scripts headers error. See what the log contains and either gzip it or null it. Restart apache and then deal with any issues that the suphp log brought to light. The suphp log is located at:
The script’s permissions may also cause this error. CGI scripts can only access resources allowed for the User and Group specified in the httpd.conf. In this case, the error may simply be pointing out that an unauthorized user is attempting to access a script.
Enabling error reporting on a PHP version of a website could help diagnose the error more in depth. Add the following snippet to your index.php file of the related site for possible additional information:
<?php error_reporting(E_ALL); ?>
Sometimes this error can be related to a trailing whitespace or returns after your closing
?> in the script/site.
If you are using a commonly used Content Management System (ex. WordPress, Drupal, Joomla, etc.) there are numerous references to these errors available online. It's beneficial to note any plugins, themes, or add-ons that you've recently installed as well as the version number of the installed CMS when searching for the issue.