1

I have installed PHP 7.2 on a Debian 9 server (a docker container actually) and installed some php modules.

But when I get to gd and pdo/mysql apt is unable to find any packages:

$apt install php-pdo
Package php-pdo is a virtual package provided by:
   php7.3-common 7.3.0-2 [Not candidate version]
   php7.0-common 7.0.33-0+deb9u1 [Not candidate version]
   php7.0-common 7.0.30-0+deb9u1 [Not candidate version]

My sources.list files looks like this:

cat /etc/apt/sources.list

deb http://deb.debian.org/debian stretch main
deb http://security.debian.org/debian-security stretch/updates main
deb http://deb.debian.org/debian stretch-updates main
deb https://packages.sury.org/php/ stretch main
deb https://packages.sury.org/apache2/ stretch main

I went through many websites recommending different things, and many of them recommending to add ondrej/php PPAs which I think is only suitable for Ubuntu systems.

PS: the software I'm trying to run over PHP has this requeriment:

  • PDO PHP Extension

Note I have the same problem with package php7.2-mysql

$apt-get install php7.2-mysql    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package php7.2-mysql
E: Couldn't find any package by glob 'php7.2-mysql'
E: Couldn't find any package by regex 'php7.2-mysql'

Edit 2: This is my output of an apt-get update (after an apt-get clean command to clean the cache):

apt-get update
Ign:1 http://deb.debian.org/debian stretch InRelease
Hit:2 http://repo.mysql.com/apt/debian stretch InRelease
Hit:3 http://deb.debian.org/debian stretch-updates InRelease
Hit:4 http://security.debian.org/debian-security stretch/updates InRelease
Hit:5 http://security.debian.org/debian-security buster/updates InRelease
Ign:6 http://deb.debian.org/debian strecht InRelease
Hit:7 http://deb.debian.org/debian buster InRelease
Hit:8 http://deb.debian.org/debian buster-updates InRelease
Hit:9 http://deb.debian.org/debian stretch Release
Ign:10 http://deb.debian.org/debian strecht Release
Ign:11 http://deb.debian.org/debian strecht/main Sources
Ign:11 http://deb.debian.org/debian strecht/main Sources
Ign:11 http://deb.debian.org/debian strecht/main Sources
Ign:11 http://deb.debian.org/debian strecht/main Sources
Ign:11 http://deb.debian.org/debian strecht/main Sources
Err:11 http://deb.debian.org/debian strecht/main Sources
  404  Not Found
Reading package lists... Done
W: The repository 'http://deb.debian.org/debian strecht Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://deb.debian.org/debian/dists/strecht/main/source/Sources  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
1

There's no such package, as PDO is embedded in the packages providing the SQL modules:

Package: php7.2-mysql
Description: MySQL module for PHP
 This package provides the MySQL module(s) for PHP.

Provides: php-mysqli, php-mysqlnd, php-pdo-mysql,
 php7.2-mysqli, php7.2-mysqlnd, php7.2-pdo-mysql

Package: php7.2-pgsql
Description: PostgreSQL module for PHP
 This package provides the PostgreSQL module(s) for PHP.

Provides: php-pdo-pgsql, php-pgsql, php7.2-pdo-pgsql

Also notice that these are not packages from Debian 9 Stretch that only has PHP 7.0. They are from the Sury.org repository deb https://packages.sury.org/php/ stretch main you have added.

7
  • I have the same problem with whits package... I'll edit original post to show it
    – user761076
    Dec 22 '18 at 19:51
  • And you have apt-get updated without errors after adding Sury? Dec 23 '18 at 7:05
  • I get a 404, I'll update OP again to show this. Thank you.
    – user761076
    Dec 23 '18 at 20:52
  • to add source list use script from: packages.sury.org/php/README.txt
    – mvladk
    Mar 28 '19 at 10:26
  • 5
    I needed it in Dockerfile, so solved it by: FROM php:7.2-apache RUN docker-php-ext-install pdo pdo_mysql
    – mvladk
    Mar 28 '19 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.