我运行了 apt-get dist-upgrade 并且我的 php 停止工作

Posted

技术标签:

【中文标题】我运行了 apt-get dist-upgrade 并且我的 php 停止工作【英文标题】:I ran apt-get dist-upgrade and my php stop working 【发布时间】:2018-08-18 17:02:34 【问题描述】:

我已经搜索但找不到有用的资源,所以我必须大声说出来。请帮我。我误跑了sudo apt-get upgrade -u dist-upgrade 之后,我服务器上的所有网站都停止了工作。我试图通过输入php -v来检查是否仍然安装了Php,但我得到了

-bash: php: command not found

我也尝试重新安装 php 使用

sudo apt-get install php

我看到了这个

sudo apt-get install php
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:
php : Depends: php7.2 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

然后我尝试运行

Sudo apt-get install php7.2

我看到了这个

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:
 php7.2 : Depends: libapache2-mod-php7.2 but it is not going to be installed or
                   php7.2-fpm but it is not going to be installed or
                   php7.2-cgi but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我也尝试安装模块:我明白了:

root@matrixpluspluto:~# sudo apt-get install php7.2 php7.2-cli php7.2-c
gi php7.2-fpm libapache2-mod-php7.2 php7.2-opcache
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:
 libapache2-mod-php7.2 : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
                         Depends: libsodium23 (>= 1.0.14) but it is not going to be installed
 php7.2-cgi : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
              Depends: libsodium23 (>= 1.0.14) but it is not going to be installed
 php7.2-cli : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
              Depends: libsodium23 (>= 1.0.14) but it is not going to be installed
 php7.2-fpm : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
              Depends: libsodium23 (>= 1.0.14) but it is not going to be installed
 php7.2-opcache : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
E: Unable to correct problems, you have held broken packages.

我检查并看到已经安装了 libc6 v2.24 请帮我。在此之前我使用的是 php7.1,升级后我开始看到 7.2。我对 php 所做的任何事情都没有成功。 Pove 已尝试解决此问题超过 2 天,请帮助。

【问题讨论】:

你能不能 purge / remove 现有的 php 并重新安装。这应该工作 尝试运行sudo apt install php7.2 php7.2-common php7.2-cli php7.2-fpm 并关注ayesh.me/Ubuntu-PHP-7.2 看看是否有帮助 我尝试删除。 sudo apt-get purge php Reading package lists... Done Building dependency tree Reading state information... Done Package 'php' is not installed, so not removed' 这就是我得到的 @BlackMamba 我试过了,没用 任何新错误?? 【参考方案1】:

不知道你是否解决了,但我遇到了同样的问题。

通过运行解决它: sudo apt-get purge php*

请注意,这不是一个好的解决方案,而是一个绝望的解决方案。我也知道我安装了哪些 php 相关的软件包,所以我不害怕命令会清除什么。 然后我查看了哪些软件包正在被清除并重新安装。 目前一切正常。

【讨论】:

以上是关于我运行了 apt-get dist-upgrade 并且我的 php 停止工作的主要内容,如果未能解决你的问题,请参考以下文章

apt-get upgarde 和dist-upgrade的差别

linux 升级命令 update upgrade dist-upgrade的区别

Debian:dist-upgrade 删除了 gnome 和许多其他东西

在Ubuntu Kylin 16.04 LTS 上源码方式安装odoo

怎么手动升级更新ubuntu系统到最新版

kali 安装命令类