We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

How to install PHP 7.3 on Ubuntu 18.04

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.

Prerequisites

  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.

PHP 7.3-FPM
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
listen.group = 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

PHP 7.3-FPM
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

Conclusion

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.

Cart

Your Cart is Empty

Back To Shop