Wednesday, October 4

VestaCP upgrade php7.3 in Ubuntu

While writing this post VestaCP is using PHP 7.2 default installed. Running Apache2 and Nginx as back-end and frontend. In this post, I’m going to show you, how to upgrade Vestacp to php7.3 in ubuntu.

First, Let’s start by checking the current version of PHP in VestaCP.

# php -v

The output will look like this. In my environment, the PHP version is 7.2.

PHP 7.2.24-0ubuntu0.18.04.6 (cli) (built: May 26 2020 13:09:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.6, Copyright (c) 1999-2018, by Zend Technologies

Second option to verify PHP version, Create phpinfo.php file in the root directory of the VestaCP hosted website. Now browse the site URL. http/s://

VestaCP PHP version

Next step, update OS, Security and Package.

# apt-get update

Next step, Install the software-properties-common and python-software-properties package. Add Ondrej PPA. And then update the sources.
Please follow the link to learn more about PPA.

# sudo apt install software-properties-common
# add-apt-repository ppa:ondrej/php
# apt-get update

Now we can install php7.3 and extensions using the command below . Restart Apache 2, and VestaCP service.

# apt install php7.3
#apt-cache policy php7.3
#apt install php7.3-fpm
#apt-cache policy php7.3-fpm
#apt install php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring php7.3-opcache php7.3-soap php7.3-zip php7.3-intl -y
# service apache2 restart
# service vesta restart

Lets check the PHP version one more time.

VestaCP PHP vesrion Check

Great, we have just updated PHP to the 7.3. Let’s verify the version using the second method by browsing the URL. http/s://

vestacp PHP version

Boohoo, The system is convinced the PHP version is updated. But VestaCP is not in the mood to listen about system advice. Since the VestaCP is using the Apache2 as backend and Nginx as frontend. Looks like Apache2 is unable to recognize the changed version of PHP.

Next Step, We are going to tell the Apache2 that the PHP version is changed. Disable an old module by removing those symlinks and enable the new module by configuring those symlinks.

Disable old PHP version.

# a2dismod php7.2

Enable new PHP version, restart the Apache2 and VestaCP services.

# a2enmod php7.3
# service apache2 restart
#service vesta restart

Lets check again by browsing the site. http/s://

PHP7.3 on VestaCP

WE DID IT.                   .   

Please don’t forget to delete phpinfo.php from the root directory. Run an “apt autoremove” command to remove old, unused, and replaced components.
Have a Nice Day


Leave a Reply

Your email address will not be published. Required fields are marked *