Installing PHP7.2 On Ubuntu 18.04

Reading Time: 1.30 mins


PHP, an open-source scripting language is the most widely used language by the web developers and regarded as the most suitable one for HTML language. One you can use this scripting language for managing of dynamic content, session tracking, databases, and also to build an e-commerce site. Being fastest than other languages, it can be integrated with other databases such as MySQL, Microsoft SQL Server, Oracle, etc. In this article, the how-to of installing, updating and testing Magneto using PHP  version 7.2 on Ubuntu 18.04 is discussed.


  • It is to be noted that the given instructions are applied to installing PHP version 7.2 on Ubuntu 18.04.
  • Presuming that you are logged in as a non-root user (in which sudo privileges is necessary).

Step: 1 Updating the default packages 

It is necessary to check whether the default packages are up to date.
To update the package index on your server, use the command:

sudo apt-get update

Now it is ready for the installation process.

STEP: 2 Installing PHP

Soon after updating the package list, the installation step is all about giving a command through the apt-package manager. 

sudo apt-get install -y php7.2

Step: 3 Installation PHP-FPM

For the installation of PHP-FPM, run the below command, 

sudo apt-get install -y php7.2-fpm

By now, PHP-FPM has been successfully installed in your system. 
Note: For managing a single website, mere installation of PHP is enough but when you want to manage multiple websites in a single server, it is recommended to install PHP-FPM, as it spawns processes/requests much faster.

Step: 4 PHP Extensions

Despite the basic PHP set up, it is necessary to install some of the other required PHP extensions for Magento such as:

  • ext-bcmath
  • ext-ctype
  • ext-curl
  • ext-dom
  • ext-gd
  • ext-hash
  • ext-iconv
  • ext-intl
  • ext-mbstring
  • ext-openssl
  • ext-pdo_mysql
  • ext-simplexml
  • ext-soap
  • ext-spl
  • ext-xsl
  • ext-zip
  • Lib-libxml

To know more:
Here, we have successfully installed PHP (by updating the default packages) and then, PHP-FPM along with the basic necessary PHP extensions for Magento. To know further about PHP-FPM optimization, visit our blog post, How to Optimize PHP-FPM ? These are the fundamental procedures to install a scripting language like PHP on Ubuntu 18.04 system.

Leave a Comment

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

Scroll to Top