Update Php
Add repo ondrej
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
Install php7.4
sudo apt -y install php7.4
php -v
php.ini
sudo gedit /etc/php/7.4/apache2/php.ini
sudo diff -y -W 120 --suppress-common-lines
/etc/php/7.2/apache2/php.ini
/etc/php/7.4/apache2/php.ini
Install some commonly used extensions
sudo apt install php7.4-common
sudo apt install php7.4-mysql
sudo apt install php-curl
Enable php7.4
sudo a2dismod php7.2
sudo a2enmod php7.4
Restart apache
systemctl restart apache2
# sudo service apache2 restart
Switch php versions
sudo a2dismod php7.4
sudo a2enmod php8.0
systemctl restart apache2
Last update: 183 days ago