install php 7.1 on debian 9.4
Hi !
Here the solution that has work for me, I found others tutorials but I had to execute a few more step to complete the setup as I want.
First, the repository, thanks to https://deb.sury.org/, the readme file is here https://packages.sury.org/php/README.txt
Based on that:
[pastacode lang= »bash » manual= »wget%20-O%20%2Fetc%2Fapt%2Ftrusted.gpg.d%2Fphp.gpg%20https%3A%2F%2Fpackages.sury.org%2Fphp%2Fapt.gpg%0A%0Ash%20-c%20’echo%20%22deb%20https%3A%2F%2Fpackages.sury.org%2Fphp%2F%20%24(lsb_release%20-sc)%20main%22%20%3E%20%2Fetc%2Fapt%2Fsources.list.d%2Fphp.list’%0A%0Aapt-get%20update%0A%0A%0A%0A » message= » » highlight= » » provider= »manual »/]
As a precision, the link for the lsb_release command man page, it is useful to get the name of your current distribution, try it on a terminal:
[pastacode lang= »bash » manual= »lsb_release%20-sc » message= » » highlight= » » provider= »manual »/]
In my case, I only want one PHP version, I don’t want to keep the 7.0, I just want have the 7.1 as default, to do that you need to install the new, remove the old without forgetting the apache module.
[pastacode lang= »bash » manual= »apt-get%20install%20php7.1%0Aapt-get%20remove%20php7.0%0A%0Aapt-get%20remove%20libapache2-mod-php7.0%0A » message= » » highlight= » » provider= »manual »/]
The php7.1 module is already installed as dependency of php7.1.
And if you need it you can do
[pastacode lang= »bash » manual= »dpkg-reconfigure%20libapache2-mod-php7.1″ message= » » highlight= » » provider= »manual »/]
Now you have php7.1 running 😉
You may want to clean more for production, but I do not cover this here, I do this on my dev env