upgrade php 8 ubuntu 20.04 1

upgrade php 8 ubuntu 20.04

# php -v (default PHP version)

# From PHP 8.0 to PHP 7.4:
sudo a2dismod php8.0
sudo a2enmod php7.4
sudo update-alternatives --set php /usr/bin/php7.4
sudo service apache2 restart

# From PHP 7.4 to PHP 8.0:
sudo a2dismod php7.4
sudo a2enmod php8.0
sudo update-alternatives --set php /usr/bin/php8.0
sudo service apache2 restart

Here is what the above code is Doing:
1. The first line is just to check the current PHP version.
2. The second line disables the PHP 8.0 module.
3. The third line enables the PHP 7.4 module.
4. The fourth line sets the PHP 7.4 as the default PHP version.
5. The fifth line restarts the Apache server.
6. The sixth line disables the PHP 7.4 module.
7. The seventh line enables the PHP 8.0 module.
8. The eighth line sets the PHP 8.0 as the default PHP version.
9. The ninth line restarts the Apache server.

Similar Posts