CentosControl PanelLinuxVesta CP

How to Upgrade PHP 5.6 to PHP 7.3 on CentOS VestaCP

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.uxlinux.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.

Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.

Related Articles

23 Comments

  1. 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

  2. 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

  3. 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

      1. 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 ~]#

          1. 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.

  4. 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 ?

  5. 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

  6. 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 ?

Leave a Reply

Your email address will not be published.

Back to top button