How to install PHP 7.4 on Debian

Fri 20, Dec 2019 php server debian

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
sh -c 'echo "deb $(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

Back to top