[HowTo]Upgrade PHP 5.6 to PHP 7.2 on CentOS VestaCP
Posted: Tue Sep 11, 2018 6:27 pm
In this tutorial I’ll show you how to upgrade PHP 5.6.xx which is by default installed by Vesta CP during installation to PHP 7.2.xx latest, I’ve tested on many server before writing this tutorial and its just working fine without any issue hence it is safe to upgrade to PHP 7.2, part of this tutorial is copied from remi repository.
Why upgrade to php 7.2 – Because it will give you security & performance boost + KICK, since WordPress will load much faster and uses less resources.
STEP 1 :
Install Remi Repository and EPEL Repository on your server :
RHEL 7
RHEL 6
CentOS 7
CentOS 6
STEP 2 :
After you have installed repository you need to follow some extra configurations :
Run this command one by one for RHEL or CentOS
STEP 3 :
Now just run this command :
You’ll see php packages are getting updated, After the update process you need to restart Apache server/php-fpm-(nginx) and check the php version from by below mentioned command:
Troubleshoot
If php upgrade process fails (no update/nothing happens) or you upgraded previously from 5.6 to 7.0/7.1 then you need to run this commands to disable php 5.6/7.0/7.1 :
After that follow the tutorial from STEP 2 again.
Why upgrade to php 7.2 – Because it will give you security & performance boost + KICK, since WordPress will load much faster and uses less resources.
STEP 1 :
Install Remi Repository and EPEL Repository on your server :
RHEL 7
Code: Select all
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
subscription-manager repos --enable=rhel-7-server-optional-rpms
Code: Select all
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
rhn-channel --add --channel=rhel-$(uname -i)-server-optional-6
Code: Select all
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
Code: Select all
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
After you have installed repository you need to follow some extra configurations :
Run this command one by one for RHEL or CentOS
Code: Select all
yum install yum-utils
yum-config-manager --enable remi-php72
Now just run this command :
Code: Select all
yum update -y
Code: Select all
php -v
Code: Select all
[root@server ~]# php -v
PHP 7.2.7 (cli) (built: Jun 20 2018 08:21:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies
If php upgrade process fails (no update/nothing happens) or you upgraded previously from 5.6 to 7.0/7.1 then you need to run this commands to disable php 5.6/7.0/7.1 :
Code: Select all
yum-config-manager --disable remi-php56
yum-config-manager --disable remi-php70
yum-config-manager --disable remi-php71