Tuesday, September 28, 2010

PHP 5.3.3 + Ubuntu 8 + Drupal 6

Problem:
Upgrade to the newest PHP (5.3.3) on Ubuntu 8.04. Make sure the instance of Drupal 6.6 works. Drupal 6.6 does not play so nice with PHP 5.3.3.

What not to do?
Don't compile from source unless you know what you're doing. I spent the better part of a day pursuing this, and in the end, I just kept on having to recompile to include this library or that. (curl, mysqli, zlib, etc). Furthermore, when I finally was "ready", none of the config changes from the existing setup were used...I gave up at that point, and went the pre-packaged route.

What to do?
From these pages, I managed to snag the pre-compiled packages for Ubuntu, and make everything go, without too much difficulties
http://www.dotdeb.org/2010/07/25/php-5-3-3-packages-are-available/
http://www.dotdeb.org/2010/07/11/dotdeb-packages-are-now-signed/

This boiled down to basically the following.

---
Add the 5.3.3 packages to dpkg sources
vim /etc/apt/sources.list
deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all

---
Add the gpg keys for this repo
gpg --keyserver keys.gnupg.net --recv-key 89DF5277
gpg -a --export 89DF5277 | sudo apt-key add -

---
apt-get update
get a local copy of all of these packages

---
Make a copy of our stuff
cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.9-28
cp /etc/php5/conf.d/imagick.ini /etc/php5/conf.d/imagick.ini.9-28
cp /etc/php5/conf.d/memcache.ini /etc/php5/conf.d/memcache.ini.9-28

---
apt-get install php5
Replace everything when it asks, we'll manually diff and peep the situation...


How to make drupal 6 work with PHP 5.3.3
It all began at http://drupal.org/node/360605...and from there, I utilized the following patches on my drupal instance. I had to rollback a few times with git, so make sure you have a rollback strategy in the event that this doesn't work for you.

curl -O http://drupal.org/files/issues/php53_remove_deprecated.patch
patch -p0 < php53_remove_deprecated.patch
To get rid of ereg deprecation warnings
for php5.3.3 upgrade

From this
http://drup.org/drupal-and-php-53
I was lead to
http://drupal.org/node/360605#comment-2273386
And applied the solution with
curl -O http://drupal.org/files/issues/drupal.php53_compat_10-D6.patch
patch -p0 < drupal.php53_compat_10-D6.patch
One hunk was not applied via the patch for me, open closer inspection, it didn't matter. (includes/common.inc.rej ... basically this didn't apply if ($errno & (E_ALL ^ E_DEPRECATED)) {...)