How to Upgrade PHP 5.6 to PHP 7.3 on CentOS VestaCP

by Sandeep B.

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.3.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.3 please be sure your script is compatible with php 7.3, part of this tutorial is copied from remi repository.

Why upgrade to php 7.3 –  Because it will give you security & performance boost + KICK, since WordPress will load much faster and uses less resources. And php 7.3 is 5% faster than any other previous version.

Upgrade to php 7.4 : https://www.mysterydata.com/how-to-install-upgrade-to-php-7-4-on-rhel-centos-vestacp/

STEP 1 :

Install Remi Repository and EPEL Repository on your server :

RHEL 7

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

RHEL 6

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

CentOS 7

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

CentOS 6

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

STEP 2 :

After you have installed repository you need to follow some extra configurations :

Run this command one by one for RHEL or CentOS

yum install yum-utils
yum-config-manager --enable remi-php73

 STEP 3 :

Now just run this command :

yum update -y

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:

php -v
[root@server ~]# php -v
PHP 7.3.0 (cli) (built: Dec  4 2018 16:12:20) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.0, Copyright (c) 1999-2018, by Zend Technologies

Troubleshoot

If php upgrade process fails (no update/nothing happens) or you upgraded previously from 5.6 to 7.0/7.1/7.2 then you need to run this commands to disable php 5.6/7.0/7.1/7.2 :

yum-config-manager --disable remi-php56
yum-config-manager --disable remi-php70
yum-config-manager --disable remi-php71
yum-config-manager --disable remi-php72

After that follow the tutorial from STEP 2 again.

If this post helps you in any way please consider a donation

Donate with PayPal :

md-donate

Donate with Paytm :

md-donate

You may also like

23 comments

Tieu Tan Tan January 2, 2019 - 4:17 pm

Your guide is high quality and worked well, I have been bookmarking this website. Thank you!

Reply
Alfred January 8, 2019 - 3:56 pm

Very good guide to upgrade to php7.3 Thanks

Reply
Artist January 24, 2019 - 2:58 pm

Thank you. It works!

Reply
Matt February 12, 2019 - 6:14 am

can you make guide to update on VestaCP Debian 9 PHP to 7.3?

Reply
Nikolay April 8, 2019 - 5:58 am

Yes, my upgrade is the correct complete.

Reply
Chris April 15, 2019 - 3:42 pm

I think this is a good article but it is a bad practice to simply do “yum update -y”. As this updates *every* package on your machine, it may cause unexpected problems with other packages. I’d strongly recommend to make that an update of the relevant packages only.

Good job though 😉

Reply
Dilmax July 21, 2019 - 2:03 pm

Great Work, this is working.
Can you please tell me how to switch between php 5.6 and 7.3? Is it possible?

Reply
faras July 30, 2019 - 3:54 am

i have instslled php 7.3 but in mariadb 10.3 i see detail used php 5.6 so my script not compatible with vestacp . before scrpt php sql work with cpanel whm

Reply
Sandy July 30, 2019 - 10:56 am

try to check the error log, check what exactly is not working.

Reply
Jordon November 14, 2019 - 9:40 pm

Hello there, it worked for RHEL 7 but not working for RHEL 6, it says “Package(s) php available, but not installed.” and I am using “subscription-manager repos –enable=rhel-6-server-optional-rpms” to enable optional rpms on RHEL 6. Any idea why is it happening ?

Reply
Sandy November 15, 2019 - 7:41 am

RHEL 6

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

Reply
Pagalworldvip January 22, 2020 - 1:21 pm

I couldn’t able to upgrade from PHP 5.6.40 to PHP 7.3 in centos. Showing warning when updating via ssh.

Reply
Sandy January 23, 2020 - 2:47 pm

what type of error screenshot or send the error texts

Reply
Designer Resource January 27, 2020 - 6:32 pm

I got this error and I’m not sure how I can resolve it, I’ve mistake and install remi for centos 7 in centos 6.

Error: Package: gd-last-2.2.5-10.el7.remi.x86_64 (remi-safe)
Requires: libtiff.so.5()(64bit)
Error: Package: gd-last-2.2.5-10.el7.remi.x86_64 (remi-safe)
Requires: libtiff.so.5(LIBTIFF_4.0)(64bit)
Error: Package: libzip-last-1.1.3-1.el7.remi.x86_64 (remi-safe)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Error: Package: gd-last-2.2.5-10.el7.remi.x86_64 (remi-safe)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Error: Package: gnupg1-1.4.20-1.el7.remi.x86_64 (remi-safe)
Requires: libc.so.6(GLIBC_2.15)(64bit)
Error: Package: libwebp7-1.0.3-1.el7.remi.x86_64 (remi-safe)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Error: Package: gd-last-2.2.5-10.el7.remi.x86_64 (remi-safe)
Requires: libpng15.so.15()(64bit)
Error: Package: gd-last-2.2.5-10.el7.remi.x86_64 (remi-safe)
Requires: libpng15.so.15(PNG15_0)(64bit)
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest
[root@server ~]# php -v
-bash: php: command not found
[root@server ~]# yum install epel-release
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.fileplanet.com
* extras: repos.lax.quadranet.com
* remi: mirrors.mediatemple.net
* remi-php55: mirrors.mediatemple.net
* remi-php71: mirrors.mediatemple.net
* remi-php72: mirrors.mediatemple.net
* remi-php73: mirrors.mediatemple.net
* remi-safe: mirrors.mediatemple.net
* remi-test: mirrors.mediatemple.net
* updates: mirrors.usc.edu
Package matching epel-release-6-8.noarch already installed. Checking for update.
Nothing to do
[root@server ~]# yum –enablerepo=epel install libwebp libwebp-devel
Loaded plugins: fastestmirror

Error getting repository data for epel, repository not found

Reply
Sandy January 29, 2020 - 2:15 am

hi you need to remove the centos 7 repo and install centos 6 repo
repo are in /etc/yum.repos.d

Reply
Designer Resource January 29, 2020 - 6:32 am

Thank you so much for your replied. I tried remove all of repo file in this folder, but it still impossible to install centos 6 repo.

[root@server ~]# rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
Preparing… ########################################### [100%]
package epel-release-7-9.noarch (which is newer than epel-release-6-8.noarch) is already installed
package remi-release-7.7-1.el7.remi.noarch (which is newer than remi-release-6.10-1.el6.remi.noarch) is already installed
[root@server ~]# yum install yum-utils
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
Nothing to do
[root@server ~]# yum-config-manager –enable remi-php73yum-config-manager –enable remi-php73^C
[root@server ~]# yum-config-manager –enable remi-php73
Loaded plugins: fastestmirror
[root@server ~]#

Reply
Sandy January 29, 2020 - 10:26 am

yum remove remi-release
then install centos 6 repo

Reply
Designer Resource January 31, 2020 - 3:50 pm

Thank you so so so much, my site runing again now. I have a question, where I can learn about these yum command? I mean where I can found document for it?

Also, I got this error when I tried use command: service httpd start

Starting httpd: [Fri Jan 31 22:43:37 2020] [warn] module ruid2_module is already loaded, skipping
httpd: Could not reliably determine the server’s fully qualified domain name, using server.xxx for ServerName

I’m not sure if here is the right place to post a question, if not, I’m understand it, but I’m very very happy with this moment, my site work up again without reinstall everything.

Sandy February 1, 2020 - 2:42 pm

hi it is better to open a topic in our forum

Farrukh Khan March 22, 2020 - 8:16 am

Hi,
I am getting following:
–> Finished Dependency Resolution
Error: Package: php-pecl-zip-1.18.2-1.el6.remi.7.3.x86_64 (remi-php73)
Requires: libzip5(x86-64) >= 1.6.1
Installed: libzip5-1.5.1-1.el6.remi.x86_64 (@remi-safe)
libzip5(x86-64) = 1.5.1-1.el6.remi
Error: Package: php-pecl-redis4-4.3.0-2.el6.remi.7.3.x86_64 (remi-php73)
Requires: liblzf.so.1()(64bit)
Error: Package: php-mbstring-7.3.16-1.el6.remi.x86_64 (remi-php73)
Requires: libonig.so.5()(64bit)
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

Reply
Sandeep B. March 22, 2020 - 9:38 am

try to remove libzip5 and then try to install again
yum remove libzip5*

Reply
Farrukh Khan March 22, 2020 - 3:43 pm

Thanks Sandeep but still getting following error:
–> Finished Dependency Resolution
Error: Package: php-pecl-redis4-4.3.0-2.el6.remi.7.3.x86_64 (remi-php73)
Requires: liblzf.so.1()(64bit)
Error: Package: php-mbstring-7.3.16-1.el6.remi.x86_64 (remi-php73)
Requires: libonig.so.5()(64bit)
You could try using –skip-broken to work around the problem

Reply
Sandeep B. March 23, 2020 - 10:56 am

its better to use our forum
https://forum.mysterydata.com/

you need to open topic there

Reply

Leave a Comment