Update PHP 5.4 on Debian 6 Squeeze

Set up Dotdeb

First add Dotdeb to your Apt sources:

sudo vim /etc/apt/sources.list
deb http://packages.dotdeb.org squeeze all
deb-src http://packages.dotdeb.org squeeze all
deb http://packages.dotdeb.org squeeze-php54 all
deb-src http://packages.dotdeb.org squeeze-php54 all

Save & Exit. Now go for the next-

curl http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -sudo apt-get update

Now Install PHP 5.4

sudo apt-get dist-upgrade

Test it-

php -v

I found there were a couple of warning messages – I had to remove the old Suhosin & APC configuration files, and manually re-install APC:

sudo rm /etc/php5/conf.d/suhosin.ini
sudo rm /etc/php5/conf.d/apc.ini
sudo apt-get install php5-apc

Optionally install MySQL 5.5

If you get this message:

The following packages have been kept back:

It’s probably because Dotdeb includes MySQL 5.5 and Squeeze includes MySQL 5.1. You can choose to upgrade with this command:

sudo apt-get install mysql-server

You may find phpMyAdmin gives a warning like this:

Your PHP MySQL library version 5.1.66 differs from your MySQL server version 5.5.30. This may cause unpredictable behavior.

You can fix this by installing the new MySQL Native Driver extension:

sudo apt-get install php5-mysqlnd


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.