php 7.2 on Debian 9?
I have tried to install php 7.2 on a Debian 9 linode based on several internet guidelines to no avail. I receive a security error.
Is it possible on Linode?
Thank you,
v/r
fos
4 Replies
Debian 10 Buster will have PHP 7.3 (It's not 7.2 I know) if you can wait till it's released to upgrade your OS. I presume it should be fairly soon. If not, you can get 7.3 as a backport from the Buster repo.
Here's Debian's guide. [https://wiki.debian.org/Backports]
Thank you for the quick response. I tried using the backports without success.
I will try again.
If all else fails, I can wait. :(
Thanks again, fos
I had to double check on that and I was wrong. The buster backport isn't available yet. You'd have to get the newer php under the testing repo.
Howdy, @fos
Like @LouWestin said, Debian 10 is slated to release in July of this year with PHP 7.3 in tow. Instead of waiting for that release and going through the trouble of upgrading your entire system, you might want to look into adding the PHP DPA maintained by Ondřej Surý. Ondřej has been packaging newer versions of PHP for Ubuntu and Debian for years, so their work is widely considered to be trustworthy and reliable. This would allow you to get PHP 7.2 on your system now, with minimal fuss.
Before you begin, you'll need the apt-transport-https
package installed so you can access the repository.
sudo apt-get install apt-transport-https
Once you've got that installed, go ahead and add the GPG key for this repo. Otherwise, apt
will get scared and won't let you download packages from it.
wget https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
Then add the repo for Debian 9 to your apt
sources.
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
After that, update your packages.
sudo apt-get update
If you get an error similar to the block below, then you still need to install apt-transport-https
.
Reading package lists… Done
E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?
E: Failed to fetch https://packages.sury.org/php/dists/stretch/InRelease
E: Some index files failed to download. They have been ignored, or old ones used instead.
Otherwise, you've now got access to php7.2
packages! Now you can run
apt search php7.2
to see the different packages available to you. The exact one you'll need depends on your software stack and use-case, but if for instance you just needed the PostgresSQL module, you could just run the following:
sudo apt-get install php7.2-pgsql