The error logs that are normally checked by the user or clients on the web server only tell you about “Premature end of script headers” in some script. First, a quick refresher course about cgi scripts. Under normal conditions, a web server will just serve files to browsers requesting them (You want “index.html”? Here it is!). Invisibly, the web server also sends along some information about the file: the size of the file, what encoding does it have, all this information is sent first in the so called “HTTP Headers”.
The premature ending of executable script headers can be an extremely vague error that leads to some headaches. Here are some suggestions that might help you fix the problem. Sometimes when executing a script you will see an error similar to the following:
Premature end of script headers: /home/directory/public_html/index.php
This error usually occurs when the server is expecting a complete set of HTTP headers (one or more followed by a blank line), and it doesn’t get them. This can be caused by several things:
Whenever a server is upgrading or downgrading to a different version of PHP; the applications can leave some residual options within the httpd.conf file. You have to check with the current version of the PHP that can be used with the following command:
version :- php -v
On the command line search for any lines mentioning another version in the httpd.conf. If you find them, comment them out, distill the httpd.conf and you can restart Apache.
The details whne a user gets with the RLimitCPU and RLimitMEM directives in the httpd.conf which are also responsible for the multiple error if a script was killed due to a resource limit.
Anothe issue may be like this where the configuration problem in suEXEC, mod_perl, or different third party app or a module which gives often interfere with the execution of the web scripts and can cause the error on the web hosting server. If above mentioned are the cause then more appropriate information relating to specifics will be found on the apache error_log.
If with the suphp’s log reaches the limit of 2GB in size or larger a user may see the multiple premature at the 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: /usr/local/apache/logs/suphp_log.
The script’s applications permissions which can cause this mentioned error. With the CGI scripts a user can, access the resources allotted for the user and the group which are specified in the httpd.conf file. In that case, the error may simply be pointing to the unauthorized user before attempting to access a script.