Upgrading PHP 5.3 to 5.4 on CentOs 6
We recently had to upgrade PHP from 5.3 to 5.4 on a CentOs 6.6 build (which by default is packaged with PHP 5.3) and found quite a number of differing tutorials and recommendations on the subject, many of which didn’t work.
We thought we’d post how we upgraded PHP successfully which doesn’t pose any potential conflicts and issues later down the line.
Open up your terminal to SSH to the server and start by grabbing/installing a reliable and trustworthy repository:-
rpm -ivh http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/ius-release-1.0-14.ius.el6.noarch.rpm
Then we listed the available and enabled repositories:-
Then we installed the
yum install yum-plugin-replace
At this stage, we took the opportunity to grab the necessary IonCube Loader from repository:-
rpm -e --nodeps php5-ioncube-loader-4.6.0-14042516.x86_64
Then we replaced the current version of PHP with PHP 5.4 from the repository above:-
yum replace php --replace-with php54
Then we installed IonCube Loader and Mcrypt for PHP 5.4 (both we needed, you will quite likely too):-
yum install php54-ioncube-loader php54-mcrypt
Then we gracefully restarted the server and checked the PHP version to ensure that upgrade was successful:-
service httpd graceful; php -v
All looking good:-
PHP 5.4.39 (cli) (built: Mar 20 2015 08:10:43) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd.
Server Information: CentOs 6.6 (Final) / Linux 2.6.32 x86_64
Panel Environment: Parallels Plesk 12.0.18
Upgraded to: PHP 5.4.39
Feel free to leave a comment explaining whether this worked or not for you…