Optimize VestaCP Part 1 – Upgrade PHP
Assuming you already have VestaCP installed, your PHP that comes along with it is probably 5.x . However, the latest PHP version as of writing is already 7.2 . There is a huge difference in performance between PHP 7.x and PHP 5.x and hence, it is important to upgrade your PHP version if you wish to optimize and speed up your server.
Now, onto the actual upgrade process. For this tutorial, the commands will be based on CentOS
1. SSH into your server.
2. Check your PHP version just to be sure you aren’t already on 7.x
If it is already PHP 7.0 and above, you need not continue with this tutorial. You may wish to proceed to the other optimization tutorials instead..
3. Stop necessary services – httpd and php-fpm
service httpd stop
service php-fpm stop
4. Remove our current PHP installation
yum uninstall php
4. Download or update the remi repository and enable it
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
yum --enablerepo=remi update remi-release
5. Install our new PHP with the modules that you wish to have or remove
yum --enablerepo=remi-php70 install php70-php php70-php-pear php70-php-bcmath php70-php-pecl-jsond-devel php70-php-mysqlnd php70-php-gd php70-php-common php70-php-fpm php70-php-intl php70-php-cli php70-php php70-php-xml php70-php-opcache php70-php-pecl-apcu php70-php-pecl-jsond php70-php-pdo php70-php-gmp php70-php-process php70-php-pecl-imagick php70-php-devel php70-php-mbstring
6. Remove old symbolic link for PHP and create a new one for our PHP 7
ln -s /usr/bin/php70 /usr/bin/php
7. Start the services again
service php70-php-fpm start
service httpd start
That’s it. You can now check if the installation is successful by doing another php -v command.