Skip to: Site menu | Main content

PHP errors on Drupal 4.7.x at Dreamhost: "Premature end of script headers: php.cgi""

Submitted by aplus on Fri, 2007-11-09 19:37.

I'm using a Drupal 4.7 on this website and for all my pages it was showing a "page not found" error. The error.log file said
Premature end of script php5.cgi
Switching over the php4 didn't help either, just the error message changed a little:
Premature end of script php.cgi

After disabling some modules in drupal, I found the the
Textile module is the culprit. The Drupal 4.7 version is not maintained anymore and is from nov. 2006. I didn't want to upgrade to Drupal 5.x so I got to find another solution.
A solution is here http://leon.info.tm/en/salvation-textile-drupal-module, but it was to much work for me, the lazy programmer that I am.

So I went to the php.net website and on the PCRE docs I found that starting with PHP 5.2 two new configurations variables appeared: pcre.backtrack_limit and pcre.recursion_limit, both with default "100000".

The solution seemed simple. Open for editing sites/default/settings.php and add these lines:
// fix for textilePHP pcre bugs ini_set('pcre.backtrack_limit', '1000'); ini_set('pcre.recursion_limit', '1000');

The default for this variables are 100,000, which due to bugs in Textile or PCRE consumes all the available process stack and eventually crashes PHP. I guess you were wondering what those "core" files were doing in your site. Those are
"core" dumps of the memory when PHP crashes. You can safely delete them.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • You can use Textile markup to format text.
More information about formatting options