1

I've got a debian image for php, php:fpm-bullseye and it runs fine. The issue is that I want to add more php packages to this image, so according to instructions online, the steps are

  1. sudo apt update
  2. sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
  3. echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
  4. wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
  5. sudo apt update
  6. sudo apt install php8.1-<extension>

Everything works fine until I get to step 6. If i run php -v it shows me

PHP 8.1.6 (cli) (built: May 28 2022 08:17:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies

So it's not like PHP isn't installed at all, but it will not find any of the extensions for php. I've run through this several times and I don't see what I am missing.

What is the proper way to install php packages on debian?

Jake Boomgaarden
  • 3,394
  • 1
  • 17
  • 31
  • Do you see the extensions available when you run a search? `apt search php` You may also need to run `apt upgrade` – Marshall C Jun 05 '22 at 12:57
  • Extensions can be seen with this `php -r "print_r(implode(', ', get_loaded_extensions()));"` – Pentium10 Jun 05 '22 at 13:05
  • Actually you want to run `php -i`, do you? – shingo Jun 05 '22 at 13:13
  • @MarshallC when I run it, I see `php8.1-common/bullseye 8.1.6-1+0~20220517.17+debian11~1.gbp6b3bd1 amd64` – Jake Boomgaarden Jun 05 '22 at 15:45
  • @MarshallC and `apt search php | grep 8.1 | grep common` was the command I had run, since I wanted to install `php8.1-common` – Jake Boomgaarden Jun 05 '22 at 15:49
  • oh.. I need to add `/bullseye` to the end of my install command I think – Jake Boomgaarden Jun 05 '22 at 15:50
  • @MarshallC please write your comment as the answer and I will accept it. What I was missing was having a good way of searching apt repos for available packages. I had tried to search for that as well but had a hard time finding a concise command like you wrote. Thank you for the quick answer! – Jake Boomgaarden Jun 05 '22 at 16:21

0 Answers0