With the recent end-of-life announcement it becomes clear that WordPress isn’t going to support PHP 5.1.6. for much longer anymore.
CentOS 5 however comes pre-compiled with PHP 5.1.6 and there are no plans to change this in the current version.
For simple folk like me it’s unimaginable to re-compile the entire OS from source or switch to a different distribution altogether. yum doesn’t help much by default – unless you’re looking in the right repositories.
Help is at hand, courtesy of the 1and1 Knowledge Base. Without further ado, here’s how to upgrade PHP on CentOS 5:
You’ll need both wget and yum installed on your machine for this to work. You can type in either command and see if you get an explanation. If you get a “command not found” message, you’ll have to install the missing packages first.
First let’s check which PHP Version your server is running:
php -v
If the answer is 4.x or 5.1.x it’s time to upgrade.
Let’s install the Atomic repository so yum can access packages. The autoinstaller will do the trick:
wget -q -O - www.atomicorp.com/installers/atomic | sh
From now on, if you use yum, it’ll look at other sources. Try this:
yum update php
This should install the latest version on your system. It can happen that you’ll get several error messages when you run this command. That’s nothing to worry about, it just means that some of your other packages may need upgrading too for a new PHP to work. What better time to upgrade everything than now:
yum update
This command will update everything on your machine, incuding PHP.
Finally, let’s see that this has done what we wanted it to do – check the PHP version again:
php -v
Is it a later version than it was? Good!
Final thoughts:
You may want to reboot your server for good measure:
/sbin/reboot
Enjoy 😉