![Ubuntu 上的 apt-get 和 php5 - 由于依赖关系而无法安装](https://linux22.com/image/1371730/Ubuntu%20%E4%B8%8A%E7%9A%84%20apt-get%20%E5%92%8C%20php5%20-%20%E7%94%B1%E4%BA%8E%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB%E8%80%8C%E6%97%A0%E6%B3%95%E5%AE%89%E8%A3%85.png)
我正在努力奔跑
sudo apt-get install php5
并收到此错误
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 : Depends: libapache2-mod-php5 (>= 5.4.17-1~dotdeb.1) but it is not going to be installed or
libapache2-mod-php5filter (>= 5.4.17-1~dotdeb.1) but it is not going to be installed or
php5-cgi (>= 5.4.17-1~dotdeb.1) but it is not going to be installed or
php5-fpm (>= 5.4.17-1~dotdeb.1) but it is not going to be installed
Depends: php5-common (>= 5.4.17-1~dotdeb.1) but it is not going to be installed
E: Broken packages
知道如何让它工作吗?
答案1
您的输出似乎表明您使用了其他存储库。因此,一种替代方法是将自己限制在官方存储库中,以避免冲突。或者可能是您的备用存储库设置为不同版本的 Ubuntu(甚至是 Debian),在这种情况下,您需要编辑 /etc/apt/sources.list 来修复它(或使用您最喜欢的 GUI 来实现此效果)。
答案2
尝试运行:
sudo apt-get update
如果您没有收到任何错误,请尝试再次安装,如果这不能解决问题,请尝试手动安装依赖项。
sudo apt-get install php5-common