Upgrade PHP Version from 7.2 to 7.3 in Ubuntu: Step-by-Step Guide

To upgrade PHP version from 7.2 to 7.3 in Ubuntu, follow these steps:

  1. Update the package list and upgrade existing packages:
sudo apt update
sudo apt upgrade
  1. Install PHP 7.3 and necessary extensions:
sudo apt install php7.3 php7.3-common php7.3-cli php7.3-fpm
  1. Disable PHP 7.2 and enable PHP 7.3:
sudo a2dismod php7.2
sudo a2enmod php7.3
  1. If you are using PHP with Apache, restart the Apache web server:
sudo service apache2 restart
  1. If you are using PHP with Nginx, restart the Nginx web server:
sudo service nginx restart
  1. Verify the PHP version to ensure the upgrade was successful:
php -v

Now, your system should be running PHP 7.3. You can also install additional PHP 7.3 extensions if needed.

Note: Before performing the upgrade, it’s always a good practice to create a backup of your important files and configurations, especially if you have existing applications running on PHP 7.2. Upgrading PHP may affect the compatibility of some applications, so make sure to test your applications after the upgrade.