Install PHP 7.2 on Debian 9

Debian 9 allows installing PHP 7.0 using apt, as I explained in this link (in Spanish).

The next version of Laravel, the 5.6, has as a requirement to have a PHP version equal to or higher than 7.1.3, so I will explain how to install the latest stable version, 7.2.

Thus I will use the DPA (Debian Package Archive) available at https://deb.sury.org/ , since the official version is not so updated.

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

Below I check the packages available in this DPA

$ sudo apt-cache search php7.2

To finish the work, I install the packages I need, including the nginx server

$ sudo apt install nginx php7.2 php7.2-common php7.2-cli php7.2-fpm php7.2-mysql php7.2-xml php7.2-curl php7.2-mbstring php7.2-zip

To verify that PHP 7.2 is installed

$ php -v
PHP 7.2.1-1+0~20180105151615.16+stretch~1.gbpd3910a (cli) (built: Jan 5 2018 15:16:17) ( NTS )

More information:

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.