How to Install PHP 7.4 on Debian 9 or Debian 10
To Ensure system updated.
apt update
If any update is available update the system and reboot.
apt upgrade -y && reboot
To Add SURY PHP PPA repository.
First download GPG key.
apt -y install lsb-release apt-transport-https ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
Next, add SURY to the repository.
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
Output:
deb https://packages.sury.org/php/ buster main
Install PHP 7.4
Ensure the added package is up to date.
apt update
If any update is available update the system and reboot.
apt upgrade -y && reboot
To install PHP 7.4.
apt -y install php7.4
To check the PHP version.
php -v
Output:
root@vps:~# php -v
PHP 7.4.6 (cli) (built: May 14 2020 10:03:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies
NOTE
- PHP configurations related to Apache is stored in
/etc/php/7.4/apache2/php.ini
this file. - If you want to use PHP with Nginx you can follow this guide Click here and if apache is installed need to disable it
systemctl disable --now apache2
This concludes our topic of installing PHP 7.4 on the Debian 10 or Debian 9 system.