In browsing the VestaCP forums, I’ve noticed many users requesting assistance on how exactly they can upgrade their PHP 5.x version to a more recent version of PHP, such as 7.3. The process is actually a lot more simple than most are making it out to be – I’ve seen some very convoluted solutions provided. So I thought I would do a quick write up on how to accomplish this running CentOS 7.x and Apache.
In order to do this, you will need the EPEL and Remi repositories enabled on this machine. The good thing about this is, if you did a default installation of VestaCP (in which I mean you did not change anything that this page generates for you on the command line in regard to the “Additional Repository” section), it will add the
remi repository for you and you can jump to this section. But if you manually changed that option, you will need to first perform the following steps. Feel free to skip these if you already have the
Installing and Enabling EPEL and Remi
In order to take advantage of the remi repository, you will first need the
EPEL repository. This is so we avoid any sort of dependency problems that arise when only the
remi repository is enabled. So first, install the
# Install the repository $ yum install epel-release # Update the repository $ yum update # Check the repository is available $ yum repolist
After that, you will want to install and enable
# Download repository $ wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm # Install repository $ rpm -Uvh remi-release-7.rpm # Enable repository $ vim /etc/yum.repos.d/remi.repo [..] enabled=1 [..] # Update repository $ yum update # Check the repository is available $ yum repolist
Enabling Remi php73 Repository
Now that you have both of the above repositories installed and enabled, it is time to enable the
remi php73 specific repository. If you did not need to perform the above step, make sure to go ahead and run
yum update to get your system’s repositories updated. Then do the following:
# Enable the remi php73 repository # Change the [remi-php73] and [remi-php73-debuginfo] enabled to 1 $ vim /etc/yum.repos.d/remi-php73.repo [..] [remi-php73] enabled=1 [..] [remi-php73-debuginfo] [..] enabled=1 [..] # Update the remi php73 repository and install PHP 7.3 $ yum clean all && yum update
After that, you will just need to issue a restart to your Apache service and you should be good to go.
To confirm your version, simply type
php -v on the command line which will print out the current PHP version your system is running.
Header art provided by Heroku Art.