To upgrade PHP version from 7.3 to 7.4 in Ubuntu, you can follow these steps:
- Update the package list and upgrade existing packages:
sudo apt update sudo apt upgrade
- Install PHP 7.4 and necessary extensions:
sudo apt install php7.4 php7.4-common php7.4-cli php7.4-fpm
- Disable PHP 7.3 and enable PHP 7.4:
sudo a2dismod php7.3 sudo a2enmod php7.4
- 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.4. You can also install additional PHP 7.4 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.3. Upgrading PHP may affect the compatibility of some applications, so make sure to test your applications after the upgrade.