How to Upgrade PHP version 5.4 to 5.6 on CentOS/RHEL 6/7
By Anuket Jain On 19 May 2015 In Linux
The PHP Development Team reports the quick accessibility of PHP 5.6.0. This new version accompanies new features, some backward incompatible changes and many enhancements.
Main features include in PHP 5.6.0 :
# php -v
PHP 5.4.35 (cli) (built: Nov 14 2014 07:04:10) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
For CentOS/RHEL 7:
# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
For CentOS/RHEL 6:
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# yum remove php-common
Sample Output:
Dependencies Resolved =================================================================================== Package Arch Version Repository Size =================================================================================== Removing: php-common x86_64 5.4.39-1.el6.remi @remi 7.0 M Removing for dependencies: php x86_64 5.4.39-1.el6.remi @remi 9.1 M php-cli x86_64 5.4.39-1.el6.remi @remi 12 M php-devel x86_64 5.4.39-1.el6.remi @remi 8.1 M php-gd x86_64 5.4.39-1.el6.remi @remi 665 k php-ldap x86_64 5.4.39-1.el6.remi @remi 119 k php-mbstring x86_64 5.4.39-1.el6.remi @remi 2.5 M php-mcrypt x86_64 5.4.39-1.el6.remi @remi 86 k php-mysql x86_64 5.4.39-1.el6.remi @remi 452 k php-pdo x86_64 5.4.39-1.el6.remi @remi 348 k php-pear noarch 1:1.9.5-9.el6.remi @remi 2.0 M php-process x86_64 5.4.39-1.el6.remi @remi 128 k php-snmp x86_64 5.4.39-1.el6.remi @remi 107 k php-xml x86_64 5.4.39-1.el6.remi @remi 626 k Transaction Summary =================================================================================== Remove 14 Package(s) Installed size: 43 M
# yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
# /etc/init.d/httpd restart
# php -v
PHP 5.6.8 (cli) (built: Apr 17 2015 22:49:36) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
Comments
The php 5.6 package was not available on centos 5, only php 5.5 was available…
Yes, Right Thanks for the information.
Hi Dennis,
I can install php 5.6.17 in centos 6.5 successfully, but when i install phpmyadmin i got fail with error : php56w-commin conflict with php-common-5.3.3-46.el6.i686
could you please recheck and info how to resolve this.
i believe this will have same error if we want to install other things related (not just phpmyAdmin). Thank you for your earliest response. I have googling 2 days but no satisfaction or reliable guide found.
Thank you,
Bun Hin
Whenever we install latest version of PHP we need to remove all PHP packages first. So first remove “php-common-5.3.3-46.el6.i686” package and then install the latest package.
Hi Again Dennis,
I tried to remove using command:
#yum remove php-common-5.3.3.-46.3l6_6.i686, but i got message “no packages marked for removal”
what command to be used here?
I very new to Linux but eager to learn. could you please further detailing the steps and the command. now i already remove the php56w, but not php5.3…
Thanks,
Bun Hin
You want to install php 5.6 or php 5.3??
Please run below command and provide me the output:
# rpm -qa | grep php
hi Dennis,
I want to install php 5.6 at the moment using webtatic. (and still study abous ius package).
The install actually success, and php56w can run ok.
But with this php56w installed, i can not install other cleanly.
For example, when i install phpMyAdmin will fail and the error is : php56w-common conflict with php-common-5.3.-46…
Could you please share how to resolve this conflict.
php 5.3.3 is not installed, only php56w but the error above persist
Thank you,
Bun Hin
Yes Sure. I will help you.
I send you an email on “cbunhin@yahoo.com” email I’d Please check the email.
This helped a lot. Thanks.
Thanks Chris.
I am having a similar problem. I was able to erase all my webtatic, but still am having trouble with conflicts over the remi files. I used the simple remove command, and got the same response, no files were marked for removal. I am trying to install the Php 5.6 from iuscommunity.
Please run the following command and provide me the output:
# rpm -qa | grep php
Also Please provide me the error you are getting at time of installation.
First of all, you wrote, that you want to install PHP 5.6 and in the end you write that you attempt to install PHP5.5
Second. I have a centos 5.7. Here is the result:
No package php56w available.
No package php56w-opcache available.
No package php56w-xml available.
No package php56w-mcrypt available.
No package php56w-gd available.
No package php56w-devel available.
No package php56w-mysql available.
No package php56w-intl available.
No package php56w-mbstring available.
Thanks for the update.
Hi heroes,
I did from step 1 to step 3 and i met problem. Please help me.
1)
type # cat /etc/redhat-release
and press enter to see the version of centos.
CentOS Linux release 7.2.1511 (Core)
2)
type # sudo yum remove php-common
to remove current php.
3)
type # sudo yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.yellowfiber.net
* extras: mirror.yellowfiber.net
* updates: mirror.yellowfiber.net
No package php56w available.
No package php56w-opcache available.
No package php56w-xml available.
No package php56w-mcrypt available.
No package php56w-gd available.
No package php56w-devel available.
No package php56w-mysql available.
No package php56w-intl available.
No package php56w-mbstring available.
Error: Nothing to do
Thank you.
I seen my problems now, because I had have “yum” and i didn’t run For “CentOS/RHEL 7” command line in step 1 above.
Hi,
Please let me know If still you have an issue.
When I do : yum install php-soap ( I have the following problem):
–> Processing Conflict: php56w-common-5.6.29-1.w7.x86_64 conflicts php-common Finished Dependency Resolution
Error: php56w-common conflicts with php-common-5.4.16-42.el7.x86_64
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest
[root@localhost ~]# rpm -qa | grep php
php56w-common-5.6.29-1.w7.x86_64
php56w-devel-5.6.29-1.w7.x86_64
php56w-gd-5.6.29-1.w7.x86_64
php56w-cli-5.6.29-1.w7.x86_64
php56w-mcrypt-5.6.29-1.w7.x86_64
php56w-mysql-5.6.29-1.w7.x86_64
php56w-xml-5.6.29-1.w7.x86_64
php56w-intl-5.6.29-1.w7.x86_64
php56w-mbstring-5.6.29-1.w7.x86_64
php56w-pdo-5.6.29-1.w7.x86_64
php56w-5.6.29-1.w7.x86_64
php56w-opcache-5.6.29-1.w7.x86_64
PLease help!
Run below command and then try again.
# yum remove php-common-5.4.16-42.el7.x86_64
Please let me know If still you have an issue.
That command yields:
yum remove php-common-5.4.16-42.el7.x86_64
Loaded plugins: fastestmirror, replace
No Match for argument: php-common-5.4.16-42.el7.x86_64
No Packages marked for removal
despite it saying it conflicts in the previous command.
I’ve installed PHP 5.6 on Centos 7 and can’t get MySQL to run for a single virtual server.
Hello, as many pointed out, this guide is impossible because PHP 5.6 is not available for Centos 5. If you replace “php56” with “php55” then it will work for Centos 5:
yum install -y php55w php55w-opcache php55w-xml php55w-mcrypt php55w-gd php55w-devel php55w-mysql php55w-intl php55w-mbstring
The problem is, you might run into a few dependency issues. I had to install libedit and t1lib, both not found in the base repository. You can either enable EPEL, or if this is not an option, download pre-compiled binaries like I did:
https://centos.pkgs.org/5/atomic-i386/libedit-3.0-2.20090923cvs.el5.art.i386.rpm.html
https://centos.pkgs.org/5/atomic-i386/t1lib-5.1.2-2.el5.art.i386.rpm.html
Then use yum localinstall xxxxxxxx.rpm
Hope that helps anyone else trying to install PHP 5.5 on Centos 5… which is definitely not recommended in 2017 but you might need to do it on old servers!
nice!, THANK YOU.
Simple and clear. Very nice Article. Thank you
Also be ware that your capcha is protecting the post comment area. I used tab trick to send this comment.
Thanks for the auspicious writeup. It in fact used to be a enjoyment account it.
Glance complicated to more delivered agreeable from you!
However, how could we communicate?
Thanks
i can’t restart with command above and i used this sudo systemctl restart httpd.service and done good.
I am ltonser. I need help. What can i do it?