Migrating CentOS 6 to PHP 5.5

I make the assumption that you’re running PHP 5.3 (the currently newest PHP version officially available in CentOS 6) or perhaps PHP 5.4 (from the same custom Remi repository).

The switch can, theoretically, be done on live system – just prepare yourself for a bit of hiccups here and there (or perhaps even serious downtime).

Start by installing Remi’s repository on your system:

To enable the repository, edit the repo file:
nano /etc/yum.repos.d/remi.repo
and set enabled to 1 in the [remi] and [remi-php55] sections of the file.

When you’re ready to flip the switch, simply run

Yum should find the newer PHP 5.5.x release from Remi’s repository and inform you that it can replace the installed version. After confirming this, your system should be already running the 5.5 release – just restart your webserver to apply and avoid out-of-sync invalid module version errors in the log.
If conflicts arise, try to solve them by manually removing / updating packages. Finally, check that all sites/services are working as expected.

Remi’s repository also contain updated MySQL packages (which will be installed by the commands above). If after updating both PHP and MySQL some of your sites no longer work as expected (and do not log useful error information), you may be hitting a weird PHP/MySQL authentication problem. This can quickly be solved by updating (re-setting) the sites’ database user password.

Sidenotes:
You can view available repositories with
yum repolist
and a list of disabled repositories with
yum repolist disabled

Leave a Reply