Google Cloud Compute Engine

How to install PHP 7.3 on Ubuntu 18.04

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

How to install PHP 7.3 on Ubuntu 18.04. In this tutorial, we will show you how to install PHP 7.3 on Ubuntu 18.04.

The latest PHP 7.3 version has been officially released on December 6th, 2018. It comes with a number of new features and a few incompatibilities that you should be aware of before upgrading from the previous version.

Checkout this guide to install PHP 7.4 on Ubuntu

This setup is tested on Google Cloud Platform, it will also work fine on other cloud serveices and on any VPS or Dedicated servers running Ubuntu.


  1. A Ubuntu server set up with sudo privileges.
  2. Completed the initial Ubuntu server setup.

If you are using Google Cloud Platform to install PHP you need the following steps to be done.

  1. A running Compute Engine, see the Setting up Compute Engine Instance with Ubuntu 18.04.

Build your career in Object Oriented PHP and MVC pattern with beginners to advanced tutorials

Here are some cloud hosting providers you can choose from with very low cost and free trial.

Getting Started

Make sure your Ubuntu server is having the latest packages by running the following command.

sudo apt update
sudo apt upgrade

This will update the package index and update the installed packages to the latest version.

Add PPA for PHP 7.3

Add the ondrej/php which has PHP 7.3 package and other required PHP extensions.

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

Once you have added the PPA you can install PHP 7.3.

Install PHP 7.3 FPM for Nginx

Execute the following command to install PHP 7.3 FPM

sudo apt install php7.3-fpm

After the installation has completed, confirm that PHP 7.3 FPM has installed correctly with this command

php-fpm7.3 -v

Install PHP 7.3 for Apache

Execute the following command to install PHP 7.3

sudo apt install php7.3

After the installation has completed, confirm that PHP 7.3 has installed correctly with this command

php -v

Install PHP 7.3 Extensions

Installing PHP extensions are simple with this syntax.

sudo apt install php7.3-extension_name

Now, install some commonly used php-extensions with the following command.

sudo 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

Configure PHP 7.3 FPM

Now that PHP 7.3.* has installed and you need to configure the user and group that the service will run under.

sudo nano /etc/php/7.3/fpm/pool.d/www.conf

Change the following lines by replacing the www-data with your username.

user = username 
group = username
listen.owner = username = username

Adjusting PHP.ini File

Now we configure PHP for Web Applications by changing some values in php.ini file.

PHP 7.3
sudo nano /etc/php/7.3/apache2/php.ini

sudo nano /etc/php/7.3/fpm/php.ini

Hit F6 for search inside the editor and update the following values.

upload_max_filesize = 32M 
post_max_size = 48M
memory_limit = 256M
max_execution_time = 600
max_input_vars = 3000
max_input_time = 1000

Hit CTRL+X and Y to save the configuration and check if the configuration is correct and restart PHP.

sudo php-fpm7.3 -t 
sudo service php7.3-fpm restart

Now you are having PHP 7.3 Installed and configured.

Prepare yourself for a role working as an Information Technology Professional with Linux operating system


Now you have learned how to install PHP 7.3 on your Ubuntu server.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.


  1. had to execute this sudo a2enmod actions alias proxy_fcgi to make it work

  2. David Bloomfield Reply

    What is the reason for installing php7.3-fpm? Is it an essential part of php7.3 or is it an optional extra?
    How would we know whether we need it?

  3. David Bloomfield Reply

    Sorry -I see now; php7.3-fpm is for Nginx as opposed to Apache

  4. Why am i getting these at last step?

    ~$ sudo php-fpm7.3 -t
    sudo: php-fpm7.3: command not found
    sudo service php7.3-fpm restart
    Failed to restart php7.3-fpm.service: Unit php7.3-fpm.service is masked.

    • May be it was that you installed php7.3-fpm and your nginx config still was pointing to some other version of php7.*-fpm.sock. Please update your Nginx config to php7.3-fpm.sock and check.

  5. Anderson Koh Reply


    I’ve issue with the final command.
    sudo service php7.3-fpm restart (Job for php7.3-fpm.service failed because the control process exited with error code.)

    After that I execute this command:
    systemctl status php7.3-fpm.service and I got this

    Need help 🙁

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.