In this blog post I want to show you how to install PHP 7.4 on Debian 9/10/11.
First we log in to the server via SSH, for example with Putty.
Now we run the following command:
- Update the server:
root@testserver ~ # apt update - Install required packages:
root@testserver ~ # apt install sudo -y - Download and add the public key for the repository:
root@testserver ~ # sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg - Add the repository:
root@testserver ~ # echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list - Update the server:
root@testserver ~ # apt update - Install PHP 7.4:
root@testserver ~ # apt install php7.4 -y
Now we can check the PHP version with the following command:
root@testserver:~# php -v
PHP 7.4.13 (cli) (built: Nov 30 2020 20:40:09) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies