• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install PHP 7.3 on Ubuntu 18.04

Written by Admin, Updated On May 7, 2019
apache, nginx, php, ubuntu
How to Install PHP 7.3 on Ubuntu 18.04

PHP is most popular and widely used open-source server-side scripting language in the world. PHP is available in various versions and PHP 7.3 is the latest version of PHP. This article will helpful to you to install a specific version of PHP. In this guide outlines how to install PHP 7.3 on Ubuntu 18.04.

Prerequisites#

Before start installation, you need Ubuntu server with a non-root user account and make sure that you have full root access.

At First, update the apt package list and upgrade the software currently installed on the server to the latest version using below commands:

sudo apt-get update
sudo apt-get upgrade

Once your system is fully up to date, we can now proceed with the PHP 7.3 installation.

Install PHP 7.3 on Ubuntu#

PHP 7.3 is available from ondrej/php PPA repository. PHP 7.3 stable version has been released with many new features and bug fixes. You can get latest news from PHP releases news.

First, we will add PPA repository for PHP 7.3 and update index list using below commands:

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

You can add PPA manually to your Ubuntu 18.04 system by copying the lines below and adding them to your system’s software sources.

deb http://ppa.launchpad.net/ondrej/php/ubuntu bionic main
deb-src http://ppa.launchpad.net/ondrej/php/ubuntu bionic main

Installing PHP 7.3 With Extensions#

Once PPA repository added, you can install PHP 7.3 with some of the most commonly used extensions by executing below command:

sudo apt install php7.3 php7.3-cli php7.3-common php7.3-opcache php7.3-curl php7.3-mbstring php7.3-mysql php7.3-zip php7.3-xml

Verify PHP Installation#

After completion of PHP installation you can verify installed PHP version with below command which will print the PHP version with details:

php -v
PHP 7.3.3-1+0~20190307202245.32+stretch~1.gbp32ebb2 (cli) (built: Mar  7 2019 20:22:46) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.3-1+0~20190307202245.32+stretch~1.gbp32ebb2, Copyright (c) 1999-2018, by Zend Technologies

Configure Apache to run PHP#

If you are using Apache web server to install PHP then you need to install Apache PHP modules by following commands :

sudo apt install php7.3 libapache2-mod-php

After that, you need to restart Apache service to enable the php modules :

sudo systemctl restart apache2

Configuring Nginx to run PHP#

Since Nginx does not contain native PHP processing like some other web servers, so we will need to install fpm (“fastCGI process manager”) which will handle PHP files.

sudo apt install php7.3-fpm

Once installation is complete the fpm service will start automatically. You can also check status by executing below command :

sudo systemctl status php7.3-fpm

Now edit your website nginx server block and add following lines to so Nginx can process PHP files :

server {
    #... other code
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
    }
    #... other code
}

To take effect of new configuration need to restart Nginx service by following command :

sudo systemctl restart nginx

Conclusion#

You have learned how to install PHP 7.3 on Ubuntu 18.04 server. You also learned how to configure PHP with Apache and Nginx web servers.

If you are facing any issue then you can send us by posting in comment box.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article Secure Nginx with Let’s Encrypt on Ubuntu 18.04
Next Article   How to Install MariaDB on CentOS 7 Server

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Python 3.11 on Debian 11
    How to Install Python on Debian 11 January 25, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook