在将mysql升级到v5.7之后,PHP在Ubuntu中出现问题

时间:2016-06-10 20:07:30

标签: php linux ubuntu ubuntu-14.04 apt-get

我在我的Ubuntu上将mysql版本从5.5升级到5.7。

但是,之后没有任何与mysql相关的工作。我也更新了php5-mysql包。

我发现我必须使用命令 sudo apt-get install php5-mysqlnd 安装php5-mysqlnd软件包。但是,它无法安装。消息:

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 resolve the situation:

The following packages have unmet dependencies:
 php5-mysqlnd : Depends: phpapi-20121212
                Depends: php5-common (= 5.5.36+dfsg-1+donate.sury.org~trusty+1) but 5.6.18+dfsg-1+deb.sury.org~trusty+1 is to be installed
E: Unable to correct problems, you have held broken packages.

我的PHP版本5.6.18-1 + deb.sury.org~trusty + 1

1 个答案:

答案 0 :(得分:1)

您有来自一个存储库的一些软件包,以及来自主存储库的一些软件包。此外,这就是错误蔓延的地方,其中一些包是保持。您选择来升级它们:

php5-mysqlnd : Depends: phpapi-20121212
               Depends: php5-common (= 5.5.36...) but 5.6.18... is to be
                        installed
E: Unable to correct problems, you have held broken packages.

可能发生的事情

在之前的升级过程中,系统出现了错误并提出了一些解决方案,其中一个解决方案是" ...继续并打破依赖关系"。你选择了那个 - 也就是说,你签署了对APT的豁免说,"我永远不会升级那个"。

现在你想做到这一点 - 你再也不能。

您需要做什么

您需要识别所持有的包裹,确定他们持有的原因,并相应地进行升级;或者回到MySQL 5.5,如果一些更重要的依赖会被打破。

apt-get update

apt-get --ignore-hold --dry-run upgrade

将告诉您如果尝试升级当前持有的那些包会发生什么。您还可以尝试--fix-missing--fix-broken选项。但是你需要的最重要的答案是,为什么这些软件包被放在第一位

如果你继续忽略所持有的包装,你就有可能破坏一些不易修复的东西。当我无意中升级了访问特定且非常挑剔的存储库所需的保留Subversion包时,我就这样做了。升级没问题,但随后我无法再提交源更改。