Premature end of script headers: Drupal Error

After moving servers today one of my accounts stopped working. The other 90 odd websites were fine, but one just threw up a blank white page.

What to do??

First check the error logs to see what the reason is, and this is what the apache error logs told me. Premature end of script headers: index.php. Of course don't forget that there are lots of error logs and sometimes a few sets in a few place - make sure you check the right ones.

This tells me that there is an issue with some kind of setting. To prove that this was true I did a check for robots.txt on the site and it worked fine. So apache was working, but something what wrong with php.

Here are some of the possible causes for this error that I discovered when googling and researching today:

  • The SuPHP log file has gotten too big - once it exceeds 2GB php stops working - Solution here, delete the log file and install log rotation, or set log rotation to include this file. This was not my error as my log rotation was working fine and the file was small.
  • PHP files are being served differently to previously. My new server was now serving via SuPHP but my old server via DSO. I changed the setting back to DSO. This might help some people, but was not the solution to my problem
  • PHP memory and max execution settings are too low. If this is the case, edit the php.ini file on your server (WHM/Cpanel have a tool to do this) and up the limit.

The last point was my issue - I didn't have enough memory in php to handle one site with many drupal modules. Once I upped the limit the site turned on as if there had never been a problem. Other drupal sites on the server had no issues becuase they had less modules and didn't go over the limit.

Once I thought back about the error, it now made sense: Premature end of script headers: index.php. It has ended early because it ran out of memory

Add new comment

Full HTML

  • Lines and paragraphs break automatically.
  • You may post PHP code. You should include <?php ?> tags.
  • Web page addresses and e-mail addresses turn into links automatically.

Filtered HTML

  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You may post PHP code. You should include <?php ?> tags.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.