Update VestaCP PHP to 7.2 on CentOS 7

By | March 17, 2018

VestaCP install PHP 5.6 by default. PHP 7.2 provide better performance than PHP 5.6. Here I will tech you how you can upgrade your PHP to 7.2.
Before continue must sure Remi repository is enabled.

First let’s make sure your server is up to date.

sudo yum update

We’ll also check what version of PHP we have installed for reference.

php -v

Now we make sure that yum-utils is installed, this is what will be used to enable the new version of PHP on the system.

sudo yum install yum-utils

If it’s already installed, great move on to the next step, if not then allow it to install.

Now we can enable remi-php72

sudo yum-config-manager --enable remi-php72

Now we can tell yum to update, this will upgrade our old version of PHP to 7.2

sudo yum update

After the process has finished your server will now have PHP 7.2 installed, we need to restart our web server for it to take effect however.

If you have Apache and NGINX installed, or just Apache installed run

sudo service httpd restart

If you are running NGINX and PHP-FPM then run

sudo service php-fpm restart && sudo service nginx restart

Lastly we’ll check the PHP version like we did at the start

php -v

And you should see something similar to the text below, although with the version of PHP you installed (7.2) instead.

PHP 7.2.3 (cli) (built: Mar 2 2018 12:41:10) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
 with Zend OPcache v7.2.3, Copyright (c) 1999-2018, by Zend Technologies

This isn’t required but if you would like to keep your system clean then we can now disable the older versions of PHP from our system. To do this run the following

sudo yum-config-manager --disable remi-php56
sudo yum-config-manager --disable remi-php55
sudo yum-config-manager --disable remi-php56-debuginfo
sudo yum-config-manager --disable remi-php55-debuginfo
sudo yum clean all
sudo yum update

And that’s it, now you have PHP 7.2 running on your VestaCP install on CentOS 7.4

Leave a Reply