How to Install PHP 7.3.3 on Ubuntu 18.04

4
12421

This guides simply describes how to install PHP 7.3.3 on Ubuntu 18.04. PHP is aserver-side, HTML-embedded scripting language. PHP 7.3.3 along with other releases such as PHP 7.2.16 and PHP 7.1.27 have been released with major security bug fixes. In this guide, we are going to focus on PHP 7.3.3. This release has come with several bug fixes and changes that are highlighted below;

  • Core:
    • Fixed bug(Core dump using parse_ini_string with numeric sections).
    • Fixed bug(Buffer Overflow via overly long Error Messages).
    • Fixed bug(Disabling class causes segfault on member access).
    • Fixed bug(Custom extension Segmentation fault when declare static property).
    • Fixed bug(PHP crashes when parsing `(2)::class`).
    • Fixed bug(iptcembed broken function).
    • Fixed bug(rename() across the device may allow unwanted access during processing).
  • COM:
    • Fixed bug(Already defined constants are not properly reported).
    • Fixed bug(Persistence confusion in php_com_import_typelib()).
  • EXIF:
    • Fixed bug(Uninitialized read in exif_process_IFD_in_TIFF).
    • Fixed bug(Invalid Read on exif_process_SOFn).
    • Fixed bug(Uninitialized read in exif_process_IFD_in_MAKERNOTE).
    • Fixed bug(Uninitialized read in exif_process_IFD_in_MAKERNOTE).
  • Mbstring:
    • Fixed bug(mb_ereg_replace() with trailing backslash adds null byte).
  • MySQL:
    • Disabled LOCAL INFILE by default, can be enabled using php.ini directive mysqli.allow_local_infile for mysqli, or PDO::MYSQL_ATTR_LOCAL_INFILE attribute for pdo_mysql.
  • OpenSSL:
    • Fixed bug(feof might hang on TLS streams in case of fragmented TLS records).
  • PDO_OCI:
    • Support Oracle Database tracing attributes ACTION, MODULE, CLIENT_INFO, and CLIENT_IDENTIFIER.
  • PHAR:
    • Fixed bug(Null Pointer Dereference in phar_create_or_parse_filename).
      Fixed bug(phar_tar_writeheaders_int() buffer overflow).
  • phpdbg:
    • Fixed bug(phpdbg support for display_errors=stderr).
  • SPL:
    • Fixed bug(DirectoryIterator glob:// don’t support current path relative queries).
      Fixed bug(openFile() silently truncates after a null byte).
  • Standard:
    • Fixed bug(Unintialized php_stream_statbuf in stat functions).
    • Fixed bug(setcookie() sets incorrect SameSite header if all of its options filled).

How to Install PHP 7.3.3 on Ubuntu 18.04

You may also want to check our previous guide on installing PHP 7.3.3 on CentOS 7.6.

Update and Upgrade Ubuntu 18.04

Well, before you can proceed, ensure that your system packages are upto-date. Run the commands below to perform system package update and upgrade.

sudo apt update
sudo apt upgrade

Add Ondrej PHP PPA repository

PHP 7.3 is a not available on Ubuntu 18.04 default repositories. Thanks to Ondřej Surý PPA repository that enables us to install the latest versions of PHP. Hence, run the command below to add this PPA repository to your Ubuntu 18.04 system.

sudo add-apt-repository ppa:ondrej/php

If you encounter the error, sudo: add-apt-repository: command not found, install the following package to fix it.

sudo apt install software-properties-common

Once the repositories are in place, re-synchronize your system packages to the latest versions.

sudo apt update

Install PHP 7.3.3 on Ubuntu 18.04

Your Ubuntu 18.04 system is now ready for PHP 7.3.3 installation. Hence, run the command below to install PHP 7.3.3 on Ubuntu 18.04.

sudo apt install php7.3

Once the installation is done, you can run the command below to verify the corresponding to the PHP 7.3.3 version in the archives and the locally installed version.

sudo apt-cache policy php7.3
php7.3:
  Installed: 7.3.3-1+ubuntu18.04.1+deb.sury.org+1
  Candidate: 7.3.3-1+ubuntu18.04.1+deb.sury.org+1
  Version table:
 *** 7.3.3-1+ubuntu18.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages
        500 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main i386 Packages
        100 /var/lib/dpkg/status

PHP 7.3.3 is now installed and ready to work with Apache web server. However, if you are looking at using PHP 7.3.3 with Nginx, you need to install PHP 7.3.3-FPM as shown below;

sudo apt install php7.3-fpm

The verification of the same can be done by running the command below;

apt-cache policy php7.3-fpm
php7.3-fpm:
  Installed: 7.3.3-1+ubuntu18.04.1+deb.sury.org+1
  Candidate: 7.3.3-1+ubuntu18.04.1+deb.sury.org+1
  Version table:
 *** 7.3.3-1+ubuntu18.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

Install PHP 7.3 Extensions on Ubuntu 18.04

Well, if you are looking at working on PHP-based web applications, you need to install various PHP extensions. You can always search for a specific PHP 7.3 extension by running the command below;

apt-cache search php7.3-*

To install a specific PHP 7.3 extension, you would run the command as shown below where <extension-name> is the name of a specific extension;

apt install php7.3-<extension-name>

Great. That is all about how to install PHP 7.3.3 on Ubuntu 18.04. Happy web scripting.

4 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here