How to install PHP 7.4 on Debian

Fri 20, Dec 2019

Installing PHP 7.4 on Debian is very simple:

apt-get install apt-transport-https lsb-release ca-certificates curl -y
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
apt-get update && apt-get install php7.4

Now run php -v to check your version.

If you need to install additional extensions: apt-get install php7.4-<extension-name>

In case you are running Apache2 and still have an old PHP version installed:

a2dismod php*.* # Replace *.* with your version number
a2enmod php7.4
systemctl restart apache2

You are on page 1 right now.


Back to top