無法在 Ubuntu 22.04 上安裝 php8.1-bcmath

無法在 Ubuntu 22.04 上安裝 php8.1-bcmath
$ sudo apt install php8.1-bcmath
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php8.1-bcmath : Depends: php8.1-common (= 8.1.2-1ubuntu2.14) but 8.1.18-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.

我確實有 8.1.18-1+ubuntu18.04.1,但沒有辦法升級到 8.1.2-1ubuntu2.14。我已經運行了 apt update 和 apt Upgrade。當我嘗試重新安裝 php 時,我得到以下資訊:

$ sudo apt reinstall php8.1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Reinstallation of php8.1 is not possible, it cannot be downloaded.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.  

答案1

您正在使用deb.sury.orgPHP 儲存庫/PPA。

bcmath庫在 sury.org 儲存庫上不可用,並且僅作為 Ubuntu 儲存庫的一部分提供。您不能將 Ubuntu 儲存庫中的 PHP 8.1 軟體包與deb.sury.org儲存庫的核心 PHP 函式庫混合搭配。

儲存deb.sury.org庫需要提供 的升級版本php8.1-bcmath,或者您必須刪除deb.sury.orgPHP 儲存庫並從 Ubuntu 儲存庫還原到 8.1.2 PHP。

這裡沒有其他“混合”解決方案。

相關內容