I'm running Drupal 4.7.6 on Windows XP Professional (SP2 + all critical updates), with MySQL 5.0.27-community-nt w/ MySQL client 5.0.22, and PHP 5.2.0. I just attempted to upgrade to PHP 5.2.1 this AM (replacing files in my C:\php directory using php-5.2.1-Win32.zip). After the upgrade to PHP 5.2.1, my Drupal site stopped displaying content in both Firefox, and IE6 (just a blank page was displayed, with the status 'Done' displayed in the status bar). I was able to successfully use phpMyAdmin using PHP 5.2.1 & look at database tables. I reverted back to PHP 5.2.0, and Drupal worked just fine. I could not find any information in Drupal's administration logs?

Comments

killes@www.drop.org’s picture

Status: Active » Postponed (maintainer needs more info)

Is there anything in the php or apache error logs?

zweeks’s picture

Yes! Thanks for the assistance! I found the following in: C:\Program Files\Apache Group\Apache2\logs\error.log (only partially displayed)...

[Fri Feb 09 07:48:09 2007] [notice] Apache/2.0.59 (Win32) PHP/5.2.1 configured -- resuming normal operations
[Fri Feb 09 07:48:09 2007] [notice] Server built: Jul 27 2006 15:55:03
[Fri Feb 09 07:48:09 2007] [notice] Parent: Created child process 4332
[Fri Feb 09 07:48:10 2007] [notice] Child 4332: Child process is running
[Fri Feb 09 07:48:10 2007] [notice] Child 4332: Acquired the start mutex.
[Fri Feb 09 07:48:10 2007] [notice] Child 4332: Starting 250 worker threads.
[Fri Feb 09 07:48:21 2007] [error] [client 172.16.12.188] PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 24576 bytes) in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\drupal\\modules\\taxonomy.module on line 363
[Fri Feb 09 07:48:21 2007] [error] [client 172.16.12.188] File does not exist: C:/Program Files/Apache Group/Apache2/htdocs/favicon.ico
[Fri Feb 09 07:48:35 2007] [error] [client 172.16.12.188] PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 6144 bytes) in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\drupal\\modules\\taxonomy.module on line 347
[Fri Feb 09 07:49:48 2007] [error] [client 172.16.12.188] PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 24576 bytes) in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\drupal\\modules\\taxonomy.module on line 363
[Fri Feb 09 07:49:55 2007] [notice] Parent: Received restart signal -- Restarting the server.

I guess that the taxonomy module doesn't like my configuration &/or PHP 5.2.1? (I also use taxonomy_access [taxonomy_access.module,v 1.92.2.5 2006/11/18 16:56:40] & taxonomy_menu[taxonomy_menu.module,v 1.17.2.1 2006/08/10 22:45:18]).

Where would I find PHP log information?

heine’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Fixed
zweeks’s picture

Status: Fixed » Closed (fixed)

Increase PHP's memory limit, by changing:

* memory_limit = 12M to my php.ini file

fixed the problem!

Thanks killes@www.drop.org & Heine!!!

gerd riesselmann’s picture

No, increasing the memory doesn't solve the problem.

I had Drupal running without problems, memory set to 20 MB, though < 6 MB used in average. Now, since PHP 5.2.1 is installed, it randomly fails and complains about memory being exhausted, for example when committing a comment or doing cron tasks. Note this happens often but not everytime.

Before PHP 5.2.1 I could even edit Modules without problems.

So, there's definitely something about PHP 5.2.1 and Drupal that's causing troubles.

gerd riesselmann’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Active
gerd riesselmann’s picture

Oh forgot to mention. The prior PHP version installed was 5.2.0. This worked perfectly.

gerd riesselmann’s picture

Just for the records: I increased memory to 24MB and still have problems.

lstrojny’s picture

This problem also occurs with other PHP-based Software like MediaWiki. And it also occurs randomly there. Are there PHP-core developers around who can give a hint?

thinkingman’s picture

I'm having exactly the same problem here. I inserted a trace command before each function, and it seems that drupal runs up until sess_close() in session.inc and then dies at that point (of course, session_close is called after all destructors, so I would imagine this is normal behavior). I notice that neither our default theme, nor any other theme include, is ever called. I'd consider myself a pretty hardcore PHP programmer, and while I've experienced this before, I've found it's generally the result of some obscure PHP function exiting without creating any error message. Someone, please help!

adam.skinner’s picture

I can corroborate this. Dreamhost recently upgraded their PHP5 to 5.2.1, and I noticed it today. Surprised that I was running on PHP4, I changed my site setting to use PHP5 and now I get a 500 error accessing the site. When I switch it back to PHP4, it works fine.

adam.skinner’s picture

After doing some more searching around, I found the following in my http error.log:

[Wed Mar 7 04:53:06 2007] [error] [client xxx.xxx.143.79] Premature end of script headers: /dh/cgi-system/php5.cgi

adam.skinner’s picture

Version: 4.7.6 » 5.1

A friend of mine who is on the same hosting provider, for whom I set up a drupal installation, is using php 5.2.1 and having no issues. I figured it was because I had modules galore installed, but that doesn't seem to be the case. I disabled every module and still have the same issue when changing to php 5.2.1 myself. I verified that I didn't have any "nonshowing" modules enabled by doing a select * from system where type = 'module' and status = 1.

So it doesn't appear to be module related.

TimK’s picture

Version: 5.1 » 4.7.6

I've experienced the same symptom on DreamHost, after the upgrade to PHP 5.2.1. On 2 different sites. The symptom was the same in both cases. In my browser, I saw "500 Internal Server Error." In my Apache error_log, I saw "Premature end of script headers: php5.cgi." I also noticed that PHP (or more specifically, php5.cgi) was dumping core in the site's base directory.

Restoring the database from a backup

In the first case, it was immediately after the PHP5 upgrade. I was trying out some unproven code on a development site, and I got the 500 error. I undid the code change, but this didn't bring back the system. I figured that I had corrupted the database and that this had somehow triggered a memory-eating bug somewhere in one of the modules. I didn't spend too much time looking into it. Instead, I simply restored the database from a suitable backup. And the site immediately started working again. So some change to the database caused--and then reversed--the problem.

Downgrading PHP

In the second case, though, I didn't have an up-to-the-minute backup of the database. And I also wanted to get to the bottom of this problem. So I spent some time looking into it. In this case, I had been having some trouble getting the attachment module to work--a different story. I installed the devel module, tweaked its configuration, and then the site stopped working. So I started by undoing what I had been trying to do. I removed the devel module. Then I went through the database, table by table, to make sure all the data looked sane. I cleared out tables like cache and sessions. And I manually disabled every module, except the ones I absolutely needed.

At each step, I requested the home page of the site. Before I did this, I deleted the cookies for that domain, so it was a clean, anonymous request. During this process, I discovered in the cache table that the elements of the page were rendrering correctly. (I had the page cache turned off at the time, however, so I don't know whether the page would have been cached.)

So the database looked clean, all but the most basic of modules had been disabled, and it was still broken.

I also noticed at this time that the core file was 8MB, which I believe is the limit DH puts on its PHP processes. But I looked at the core dump of the first case, the development site I talked about above, and it's file was 13.2MB. So I don't know what's going on with this.

Finally, I changed the version of PHP on this virtual host back to 4.4.2 (a trivial DH config change), and the site started working again.

-TimK

TimK’s picture

Running out of brain cells for today... I might look into this more tomorrow. But I'd appreciate it if someone else could comment as well.

In the PHP docs for session_set_save_handler(), it says:

Warning: Write and Close handlers are called after destructing objects since PHP 5.0.5. Thus destructors can use sessions but session handler can't use objects. In prior versions, they were called in the opposite order...

Now, I'm still learning the Drupal codebase, so I may be off here. But looking at session.inc, sess_write() (which is Drupal's session-write handler) appears to use the $user object.

Furthermore, I seem to remember reading somewhere that explicitly calling session_write_close() was a change between Drupal 4.7.5 and 4.7.6. Could a Drupal guru give input on this?

If this is the case, it may explain why upgrading to Drupal 4.7.6 under PHP5 causes a problem and why downgrading to PHP4 works around it. (But as I said, it's late, and I'm running out of brain cells. So I may be talking gibberish.)

-TimK

mattrock’s picture

Category: support » bug
Priority: Critical » Normal

I had this same problem @ dreamhost. The Premature end of script headers: /dh/cgi-system/php5.cgi appeared in my http log after making some changes in the devel module settings. Changing the host back to PHP4 got me back into the site.

cburschka’s picture

I get the "Premature end of script headers" message on all Drupal sites running on DH's default PHP 5.2.2. Since I compiled my own version of 5.2.1 back when DH had 5.1.3, I didn't notice this before. When I noticed that I was a version behind, I decided to go back to default instead of updating my own installation, but this broke my site.

heine’s picture

Status: Active » Closed (won't fix)

For server issues with dreamhost, contact dreamhost technical support.

They are running a buggy version of Zend Optimizer that causes certain PHP functions to crash the interpreter. The devel module makes such a call (see also http://drupal.org/node/152289).