Drupal Dilatant: When PHP Upgrade Cripples Instead of Improve Your Drupal Sites

Your host upgrades it’s php version to 5.2 or higher and you’re thinking, “great, now I have more functions to play around with.” Then you start getting emails from Drupal clients who claim they cannot login even after having the site reset their password. Or they login and as soon as they click on any link, they are told they can’t access that page, even if they’re are admin users.

That doesn’t sound credible. If something breaks on one site, how could it happen on others about the same time?

Unfortunately for me, the first emails came just from users of just one site and I assumed the issue is site-specific. I spent an entire afternoon looking for a solution, only to give up and basically rebuilt the site on a newer version over the next week or so. A lot of work, all the while clients of the site left out in the cold. It was especially difficult, because I myself, the User 1, who is supposed to have global privileges irrespective of the settings, could not stay logged in.

When the same reports came from other sites I began looking for a solution again.

To cut the story short, the issue has to do with some 4.6 and 4.7 sites conflicting with php 5.2+ and not being able to retain sessions.

The real solution: you do have to upgrade to 5 and higher versions.

The temporary solution — and this what I wish I had when I went through the torturous process of upgrading the first site:

Put the following in the bottom of your SITES/SETTINGS.PHP page.

// Temporary fix to login/sessions problem.
// Remove this line when upgrading to 4.6.11, 4.7.11 or 5.x or later.
register_shutdown_function('session_write_close');

That’s it. This will keep the site functional until, hopefully, you do get around upgrading.

More info here: http://drupal.org/node/102114