PHP 7.3 installations steps in Ubuntu 20.04

Php 7.3 version installation steps in Ubuntu 20.04

 

PHP installations can be tricky in many situations especially when you are not having any control panels installed in the server. This document is related to the steps to install php 7.3 on a Ubuntu 20.04 server. Also here we have explained the steps to change the php version of a website when the server’s current php version is a different one. The method shared is based on ondrej PPA repository. To run a website on a specific PHP version, it needs some PHP extensions also, so we need to install those PHP extensions too.

The php version needed for a particular website may vary depending on the type of website hosted.  The website code may have compatibility issues which will also require it to work in a specific php version. The server which has a hosting control panel installed the php version can be changed in one click. But for a no-panel server, we need to do the steps manually from the terminal. Follow the instructions below to install PHP 7.3 on Ubuntu 20.04 and change the php version of only one website different than the server using “ondrej PPA repository”.

Add ondrej PPA repository to your system

# apt install software-properties-common
# add-apt-repository ppa:ondrej/p>
# apt update

Install php7.3 and check it’s installed.

# apt install -y php7.3
# php -v 
OR
# apt install -y php7.3 php7.3-fpm - to install php7.3 and php7.3-fpm
# php -v

Configurations

Find out the php socket from the apache configuration file (virtual host)

# ll /etc/apache2/sites-enabled/mywebsite.com.conf 
( Need to made changes only if there are any specific lines related to running php version )

find out the configuration file inside the currently running php version

# ll /etc/php/7.3/fpm/pool.d/mywebsite.com.conf

Copy that config. file to new php version that we need to run that website
OR
create a config. file-based on sample www.conf inside the pool.d folder.

Check php extensions

You can search for the missing modules but searching it using the command “apt-cache search string” Or dpkg command. 

# apt-cache search php | grep "^php7"
# dpkg --get-selections | grep -i PHP

Install php extensions

The default installation will not come with all the required extensions needed for the website. So we need to check the site requirements or check the old php version and  add the missing e tensions to the newly installed php version using the following command.

# apt install php7.3-curl

Conclusion

These type of installations are needed for the websites which require high availability or custom requirements, which doesn’t support normal control panel servers. If you need assistance in setting up this kind of setup you can check our cPanel Server management plans or Hourly Server management plan for one-time support, also check Nixtree.com for similar useful information.

Facebook Comments