I found some blog posts about this, but it’s rather lack of descriptions on possible side effects.
I could really use some detailed on these steps:
- How to add a repo that provides PHP 5.4 into yum
- Can this seamlessly replaces the current PHP version in CentOS?
- How can I switch back to the official repo when it supports PHP 5.4? (current 5.3.3 in my system)
- Will there be any potential to break PHP modules I currently using?
Note
People successfully upgraded with the same method on newer versions, and suggest removing specific versions in the question. While it is good to pin down versions in case newer versions actually breaks something, I’d like keep the latest succeed version suggested by the community as a note.
Feel free to update this if you have successfully upgraded on other versions.
- PHP versions: 5.4, 5.5
- CentOS version: 6
I followed the instructions from Install Apache/PHP 5.4.10 on Fedora 17/16, CentOS/RHEL 6.3/5.8 with a slight modification. It took maybe 10min. My exact commands are shown below. Note that the first command had to be changed from what is shown in the article. The change was from epel-release-6-7.noarch.rpm
to epel-release-6-8.noarch.rpm
.
-
How to add a repo that provides PHP 5.4 into yum?
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
-
Can this seamlessly replace the current PHP version in CentOS? For me the following commands worked and none of my existing PHP web pages broke. Your mileage may vary.
yum --enablerepo=remi,remi-test install httpd php php-common yum --enablerepo=remi,remi-test install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml service httpd restart
-
How can I switch back to the official repo when it supports PHP5.4? I have not tested the commands to remove and re-install PHP from CentOS repositories, but these should work.
# Remove the Remi packages. Note the reversed command order yum remove php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml yum remove httpd php php-common # Install the CentOS packages. yum install httpd php php-common yum install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
-
Will there be any potential to break PHP modules I [sic] currently using? Yes. Using a recent version of CentOS (6.2?) with Zend installed using the Zend installer, the above upgrade broke Zend.
All the above commands were run as root
. Best practice is to login as a non-privileged user and use sudo
. (This is a development VM with a current snapshot…)
Also, do NOT enable the Remi repository by default – in the past I got clever and enabled it by default and things broke, even with repository priority.
Check more discussion of this question.