首页 文章

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

提问于
浏览
2

我在我的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 回答

  • 1

    您有一个来自一个存储库的软件包,还有一些来自主存储库 . 此外,这是错误蔓延的地方,其中一些包是 held . 您选择不升级它们:

    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.
    

    What probably happened

    在之前的升级过程中,系统出现了错误,并提出了一些解决方案,其中一个解决方案是“......继续 and break dependencies ". You chose that one -- i.e., you signed a waiver to APT saying, "我永远不会升级它” .

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

    What you need to do

    您需要识别那些被保留的包,确定它们被保留的原因,并相应地升级它们;或者回到MySQL 5.5,如果一些更重要的依赖会被打破 .

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

    将告诉你如果你尝试升级当前持有的那些包会发生什么 . 您还可以尝试 --fix-missing--fix-broken 选项 . 但你需要的最重要的答案是,为什么这些包装首先被阻止 .

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

相关问题