500 Server error: Premature end of script headers: 500 Server error: Premature end of script headers: codeigniter codeigniter

500 Server error: Premature end of script headers:


This error is usually (sometimes) caused by the FastCGI setup of the FcgidIOTimeout directive (old name: IPCCommTimeout).

That is the number of seconds for IO timeout, default is 40 seconds. Timeout means that

"The FastCGI application must begin generating the response within this period of time. Increase this directive as necessary to handle applications which take a relatively long period of time to respond."

You can try to solve it putting this into your vhost.conf:

<IfModule mod_fcgid.c>  # 5 minutes for IO timeout, default is 40 seconds  FcgidIOTimeout 300</IfModule>

You can increase it as you need and then restore the original value once the reindexing process is complete.


There is a good list about the possibilities on Liquid Web's KB;

  1. Upgrading or downgrading to a different version of PHP can leave residual options in the httpd.conf. Check the current version of PHP using php -v on the command line and search for any lines mentioning another version in the httpd.conf. If you find them, comment them out, distill the httpd.conf and restart apache.

  2. 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.

  3. 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.

  4. 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: /usr/local/apache/logs/suphp_log

  5. 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.

http://www.liquidweb.com/kb/apache-error-premature-end-of-script-headers/

If I were in the same situation, I'd check the permissions first then continue with 3 and 4.


I was also receiving this error message in etc/httpd/logs/error_log after a 500 Internal server error trying to load a website.

For me, the solution was permissions - had to chmod 755 the file. I had created the file as a higher access level user than the one that was "loading" the site on the server.