To upgrade PHP version from 7.2 to 7.3 in Ubuntu, follow these steps:
- Update the package list and upgrade existing packages:
sudo apt update sudo apt upgrade
- Install PHP 7.3 and necessary extensions:
sudo apt install php7.3 php7.3-common php7.3-cli php7.3-fpm
- Disable PHP 7.2 and enable PHP 7.3:
sudo a2dismod php7.2 sudo a2enmod php7.3
- If you are using PHP with Apache, restart the Apache web server:
sudo service apache2 restart
- If you are using PHP with Nginx, restart the Nginx web server:
sudo service nginx restart
- Verify the PHP version to ensure the upgrade was successful:
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.