suPHP Premature end of script headers

I don’t really advise using suPHP these days when the power and flexibility of mod_php will handle most of your needs. However, for a shared dev environment where you want to specify the apache user in the config file, suPHP works pretty well.

There is one major problem with it though and that is the logs fill up pretty fast and once you hit a 2GB log file, apache will start throwing 500 errors. The first thing people check are the apache log files and see the dreaded “Premature end of script headers”. And since this offers no other useful info, you go search on Google for what the hell this means. Google comes back with the official suPHP site which gives you some mumbo jumbo on CLI versions being installed in the place of CGI versions. But you know this isn’t the case, because you haven’t touched the machine in months and everything was working fine. You panic.

Most of the other stuff Google brings back are threads of people panicking because these 500 errors are being thrown on live sites. Some threads suggest you look at the log files. And this is good advice. However, there are a couple things to watch out for:

  1. usually the suphp.log file is the culprit. It lives in /var/log/suphp.log. If this has hit 2GB, roll it and apache will be good to go.
  2. there is no suphp.log file in /var/log. In this case, check your suphp.conf file for the location. The conf file is usually located in /etc/httpd/suphp/ or similar.
  3. if your conf file is pointing to a log file that is under 2GB, you need to dig a tad deeper. Check out your php.ini file and see if/where you are saving your php error file. Check if this file is over 2GB.

If the above doesn’t solve the problem. You need to take some drastic measures and find all files on your system that are 2GB or larger. The “find” command will work nicely for this.

Hey, like this post? Why not share it with a buddy?

Leave a Comment