如何安装旧版本的 php5-mhash 包?

如何安装旧版本的 php5-mhash 包?

我的 PHP 版本固定在 5.2.x,这是命令行输出

php -version
PHP 5.2.10-2ubuntu6 with Suhosin-Patch 0.9.7 (cli) (built: Oct 23 2009 16:30:10) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

运行此命令来安装php5-mhash

sudo apt-get install php5-mhash

这是错误信息

Reading package lists... Done Building dependency tree        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:   php5-mhash: Depends:
php5-common (= 5.2.10.dfsg.1-2ubuntu6.10) but 5.2.10.dfsg.1-2ubuntu6
is to be installed E: Broken packages

我的问题是如何修复此问题?我可以安装旧版本吗?php5-mhash如果可以,我该怎么做?

以下是运行后的输出sudo apt-get install -f::

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

好吧,如果有人遇到这个问题,我就明白了。

手动下载并安装

步骤如下:

(我正在使用 Karmic Repo 来匹配我固定的版本)

从此处下载匹配的版本php-common 5.2.10.dfsg.1-2ubuntu6。我的机器上安装的是这个版本这是我下载的版本

然后我手动安装了该包,如下所示:

sudo dpkg -i php5-mhash_5.2.10.dfsg.1-2ubuntu6_i386.deb

输出:

Selecting previously deselected package php5-mhash. (Reading database
... 357032 files and directories currently installed.) Unpacking
php5-mhash (from php5-mhash_5.2.10.dfsg.1-2ubuntu6_i386.deb) ...
Setting up php5-mhash (5.2.10.dfsg.1-2ubuntu6) ...

笔记:在找到要下载并安装的正确版本之前,我确实安装了错误的版本。输出如下:

$ sudo dpkg -i php5-mhash_5.2.6.dfsg.1-3ubuntu4_i386.deb  
Selecting previously deselected package php5-mhash.
(Reading database ... 357032 files and directories currently installed.)
Unpacking php5-mhash (from php5-mhash_5.2.6.dfsg.1-3ubuntu4_i386.deb) ...
dpkg: dependency problems prevent configuration of php5-mhash:
  php5-mhash depends on php5-common (= 5.2.6.dfsg.1-3ubuntu4); however:
    Version of php5-common on system is 5.2.10.dfsg.1-2ubuntu6.
dpkg: error processing php5-mhash (--install):
  dependency problems - leaving unconfigured
Errors were encountered while processing:  php5-mhash

运行此命令来修复损坏的安装:

sudo apt-get -f install

输出:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer
required:
  libmhash2
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  php5-mhash
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 69.6kB disk space will be freed. Do you
want to continue [Y/n]? y
(Reading database ... 357033 files and directories currently installed.)
Removing php5-mhash

答案2

只需重命名/etc/php5/mods-available/pdo.ini/usr/lib/php5

相关内容