The awaited latest version of the PHP 7.3 was released on 6th December 2018. Along with 7.3 release, 4 other PHP versions were updated.
PHP 5.6.39 and PHP 7.0.33 are both security releases considered to be the last release in their respective branches.
PHP 7.1 is now security only.
Users of these are required to immediately switch to 7.2 or 7.3.
To update your version of PHP to 7.3:
1. Add the ondrej/php PPA
sudo add-apt-repository ppa:ondrej/php # Press enter to confirm. sudo apt-get update
sudo apt install apt-transport-https lsb-release sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg # Download the signing key sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' # Add Ondrej's repo to sources list. sudo apt update
2. Install PHP 7.3 and required extensions
To install PHP 7.3 core:
sudo apt install php7.3 php7.3-common php7.3-cli
Install required extensions:
php7.3- with an extension that’s required.
For example to get the php-curl extension use php7.3-curl
sudo apt install php7.3-curl php7.3-json php7.3-gd php7.3-mbstring php7.3-intl php7.3-bcmath php7.3-bz2 php7.3-readline php7.3-zip
PHP 7.3 for web server:
To integrate PHP with your web server, If you are using Nginx, or Apache with mod_event, you will need to install
php7.3-fpmpackage. If you are using PHP as an embedded Apache module, you will need the package
libapache2-mod-php7.3. For Apache, you can use
apachectl -V to see your current MPM, whether it’s
Nginx and Apache with
sudo apt install php7.3-fpm
sudo apt install libapache2-mod-php7.3
3. Uninstall old PHP versions:
sudo apt purge php7.2 libapache2-mod-php7.2 # For removing PHP 7.2 sudo apt purge php7.1 libapache2-mod-php7.1 # For removing PHP 7.1 sudo apt purge php7.0 libapache2-mod-php7.0 # For removing PHP 7.0
4. Enable php7.3 for Apache
sudo a2enmod php7.3
5. Verify PHP 7.3 installation:
To verify the installation of PHP 7.3
From web server:
Create a file
info.php. It must be saved to a very specific directory, which is called the “web root”. In Ubuntu and Debian this is located at
sudo nano /var/www/html/info.php
<?php phpinfo(); ?>
When you are finished, save and close the file.
Now visit this script in your browser.
You should see something similar to this.
You should remove this file after this test because it could actually give information about your server to unauthorized users. To do this, you can type this:
sudo rm /var/www/html/info.php
So now you have PHP 7.3 up and running. See the migration guide for PHP 7.3 at php.net