Are you one of VestaCP fans? Then you should know this trick.
By default, VestaCP installs only a single version of PHP on your server. It can be PHP v5.x or v7.x, depending on your system and VestaCP version.
The good news is… you can now have multiple PHP versions on a single VestaCP stack without having to install CloudLinux.
You can have similar experience as hosting your websites on cPanel or Directadmin powered with Cloudlinux.
This will come in handy if you host many websites built upon differences web apps, be it WordPress, Joomla, Codeigniter, Laravel, and so on.
When your web apps require different versions of PHP, you can still go with VestaCP to host them on a single server.
And what we liked so much about this free control panel is its minimum specs requirement. Yes, you can install it on a VPS or cloud with 512MB RAM.
Let’s get into the tutorial.
This will install php version 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3 and 7.4.
Requirements
You should already have VestaCP installed. If not, follow our guide here.
Next, you should install VestaCP on a CentOS server. Per last time we tested, this trick works on CentOS 7 and CentOS 6.
Of course, you also need to have access to your CentOS server via ssh. Putty or Terminal will come in handy.
Install Multi PHP Selector on VestaCP
First, log in to your server as root or as a user with sudo priviledge.
Second, install Nano text editor to make editing files easy on your Linux server.
yum install nano -y
Third, install git with this command:
yum install git -y git --version

Next, clone the Php Selector git repo:
git clone https://github.com/Skamasle/sk-php-selector.git cd sk-php-selector

Make sure you have Remi repository added on your server:
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm
Activate or enable Remi repo. Use Nano editor to edit its config:
nano /etc/yum.repos.d/remi.repo
Now change enabled=0 to enabled=1 as indicated in the picture below:

Now you should have Epel repo activated.
yum repolist

Finally, install Multiple PHP selector addon on VestaCP using this simple command:
bash sk-php-selector3.sh all
Sit tight and wait for the tool to install all supported PHP versions.

Finally, open up your browser and log in to VestaCP dashboard.
Go to Web > choose the site’s name you wish to change its PHP version > click Edit.

Click the drop down menu of Web Template HTTPD. Choose the PHP version you wish.

Don’t forget to click the Save button.
That’s it. Now create info.php file with following code:
<?php phpinfo(); ?>
Upload it on your website and open it on browser.

And here’s…

However, the default PHP-cli version will not change.
Try issuing php-v command and you’ll see the old version instead.
That’s all.
Since this php selector module is not VestaCP’s official addon, please expect some bugs.
This method can break phpmyadmin.
If that happens, please delete some mod_php files in /etc/httpd/conf.d/ or you can just move out all php-.conf files.
Enjoy!
Credits belong to Skamasle.