Debian 9 使用 PHP 7.2:无法安装 PDO PHP 扩展

Debian 9 使用 PHP 7.2:无法安装 PDO PHP 扩展

我已经在 Debian 9 服务器(实际上是一个 docker 容器)上安装了 PHP 7.2 并安装了一些 php 模块。

但是当我到达gd并且pdo/mysql apt找不到任何包时:

$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]

我的 sources.list 文件如下所示:

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

我浏览了许多网站,推荐不同的东西,其中许多都建议添加 ondrej/php PPA,我认为这只适合 Ubuntu 系统。

PS:我尝试通过 PHP 运行的软件有以下要求:

  • PDO PHP 扩展

笔记我对包有同样的问题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'

编辑2:这是我的输出apt-get update(在apt-get clean清除缓存的命令之后):

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

没有这样的包,因为 PDO 嵌入在提供 SQL 模块的包中:

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

还请注意,这些不是来自 Debian 9 Stretch 的软件包,仅PHP 7.0。它们来自Sury.orgdeb https://packages.sury.org/php/ stretch main您已添加的存储库。

相关内容