Upgrading PHP on CentOS 6.5 (Final)
up vote 61 down vote favorite
39
I'm trying to update my PHP (currently v:5.3.3 to the latest stable PHP build) but it's not playing ball and it's saying there is nothing to update.
Any help would be useful.
Keeps saying:
No Packages marked for Update
asked Feb 1 '14 at 19:41
5941727
add a comment
7 Answers
up vote 114 down vote accepted
As Jacob mentioned, the CentOS packages repo appears to only have PHP 5.3 available at the moment. But these commands seemed to work for me...
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum remove php-common # Need to remove this, otherwise it conflicts
yum install php56w
yum install php56w-mysql
yum install php56w-common
yum install php56w-pdo
yum install php56w-opcache
php --version # Verify version has been upgraded
You can alternatively use php54w
or php55w
if required.
CAUTION!
This may potentially break your website if it doesn't fully resolve all your dependencies, so you may need a couple of extra packages in some cases. See here for a list of other PHP 5.6 modules that are available.
If you encounter a problem and need to reset back to the default, you can use these commands:
sudo yum remove php56w
sudo yum remove php56w-common
sudo yum install php-common
sudo yum install php-mysql
sudo yum install php
(Thanks Fabrizio Bartolomucci)
answered Jun 22 '14 at 12:38
28.2k109291
up vote 27 down vote
For CentOS 6, PHP 5.3.3 is the latest version of PHP available through the official CentOS package repository. Keep in mind, even though PHP 5.3.3 was released July 22, 2010, the official CentOS 6 PHP package was updated November 24, 2013. Why? Critical bug fixes are backported. See this question for more information: "Why are outdated packages installed by yum on CentOS? (specifically PHP 5.1) How to fix?"
If you'd like to use a more recent version of PHP, Les RPM de Remi offers CentOS PHP packages via a repository that you can add to the yum package manager. To add it as a yum repository, follow the site's instructions.
Note: Questions of this variety are probably better suited for Server Fault.
11
answered Feb 1 '14 at 20:44
6,95832231
add a comment
up vote 7 down vote
I managed to install php54w according to Simon's suggestion, but then my sites stopped working perhaps because of an incompatibility with php-mysql or some other module. Even frantically restoring the old situation was not amusing: for anyone in my own situation the sequence is:
sudo yum remove php54w
sudo yum remove php54w-common
sudo yum install php-common
sudo yum install php-mysql
sudo yum install php
It would be nice if someone submitted the full procedure to update all the php packet. That was my production server and my heart is still rapidly beating.
answered Jan 30 '15 at 13:56
102210
add a comment
up vote 5 down vote
This is the easiest way that worked for me: To install PHP 5.6 on CentOS 6 or 7:
CentOS 6. Enter the following commands in the order shown:
yum -y update
yum -y install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget https://centos6.iuscommunity.org/ius-release.rpm
rpm -Uvh ius-release*.rpm
yum -y update
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
CentOS 7. Enter the following commands in the order shown:
yum -y update
yum -y install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://centos7.iuscommunity.org/ius-release.rpm
rpm -Uvh ius-release*.rpm
yum -y update
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
Sorry - I'm unable to post the source URL - due to reputation
4,46641235
answered Dec 28 '16 at 4:59
22437
add a comment
up vote 2 down vote
Verify current version of PHP Type in the following to see the current PHP version:
php -v
Should output something like:
PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Install the Remi and EPEL RPM repositories
If you haven’t already done so, install the Remi and EPEL repositories
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && rpm -Uvh remi-release-6*.rpm
Enable the REMI repository globally:
nano /etc/yum.repos.d/remi.repo
Under the section that looks like [remi] make the following changes:
[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Also, under the section that looks like [remi-php55] make the following changes:
[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Type CTRL-O to save and CTRL-X to close the editor
Upgrade PHP 5.3 to PHP 5.6 Now we can upgrade PHP. Simply type in the following command:
yum -y upgrade php*
Once the update has completed, let’s verify that you have PHP 5.6 installed:
php -v
Should see output similar to the following:
PHP 5.6.14 (cli) (built: Sep 30 2015 14:07:43)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
1,40832153
answered Aug 30 '16 at 17:19
213
add a comment
up vote 2 down vote
This answer by Amine worked great. I would add that I had the need to keep one of the IPs on 5.3.3. I was able to do this in Pleks Onyx with the CGI application run by Apache. Not sure why the Fast CGI application didn'y work however. But, then I switched it back to the Fast CGI, and it worked.
answered Apr 3 '17 at 21:20
73110
add a comment
up vote 0 down vote
IUS offers an installation script for subscribing to their repository and importing associated GPG keys. Make sure you’re in your home directory, and retrieve the script using curl:
curl 'https://setup.ius.io/' -o setup-ius.sh
sudo bash setup-ius.sh
Install Required Packages-:
sudo yum install -y mod_php70u php70u-cli php70u-mysqlnd php70u-json php70u-gd php70u-dom php70u-simplexml php70u-mcrypt php70u-intl
For more details visit to My Article.
answered Apr 18 '16 at 19:03
491
add a comment
protected by Community♦ Apr 27 '17 at 11:29
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?