由于未满足依赖关系,无法安装 libapache2-mod-php5

由于未满足依赖关系,无法安装 libapache2-mod-php5

我有一个安装了 php 5.3.28 和大多数 php 库的 vagrant box

dpkg -l |grep '^ii' |grep php
ii  php5-cgi                         5.3.28-1~dotdeb.0                 server-side, HTML-embedded scripting language (CGI binary)
ii  php5-cli                         5.3.28-1~dotdeb.0                 command-line interpreter for the php5 scripting language
ii  php5-common                      5.3.28-1~dotdeb.0                 Common files for packages built from the php5 source
ii  php5-curl                        5.3.28-1~dotdeb.0                 CURL module for php5
ii  php5-dbg                         5.3.28-1~dotdeb.0                 Debug symbols for PHP5
ii  php5-fpm                         5.3.28-1~dotdeb.0                 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php5-gd                          5.3.28-1~dotdeb.0                 GD module for php5
ii  php5-gmp                         5.3.28-1~dotdeb.0                 GMP module for php5
ii  php5-imap                        5.3.28-1~dotdeb.0                 IMAP module for php5
ii  php5-interbase                   5.3.28-1~dotdeb.0                 interbase/firebird module for php5
ii  php5-intl                        5.3.28-1~dotdeb.0                 internationalisation module for php5
ii  php5-ldap                        5.3.28-1~dotdeb.0                 LDAP module for php5
ii  php5-mcrypt                      5.3.28-1~dotdeb.0                 MCrypt module for php5
ii  php5-mysql                       5.3.28-1~dotdeb.0                 MySQL module for php5
ii  php5-odbc                        5.3.28-1~dotdeb.0                 ODBC module for php5
ii  php5-pspell                      5.3.28-1~dotdeb.0                 pspell module for php5
ii  php5-recode                      5.3.28-1~dotdeb.0                 recode module for php5
ii  php5-snmp                        5.3.28-1~dotdeb.0                 SNMP module for php5
ii  php5-sqlite                      5.3.28-1~dotdeb.0                 SQLite module for php5
ii  php5-tidy                        5.3.28-1~dotdeb.0                 tidy module for php5
ii  php5-xmlrpc                      5.3.28-1~dotdeb.0                 XML-RPC module for php5
ii  php5-xsl                         5.3.28-1~dotdeb.0                 XSL module for php5

但当我这样做时 sudo apt-get install libapache2-mod-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:
 libapache2-mod-php5 : Depends: php5-common (= 5.3.10-1ubuntu3.14) but 5.3.28-1~dotdeb.0 is to be installed
E: Unable to correct problems, you have held broken packages.

我该如何解决这个问题?

答案1

Ubuntu软件包libapache2-mod-php5(您尝试安装的软件包)需要其他 PHP 软件包(例如php5-common)的 Ubuntu 版本。但是,您安装的软件包就是这些~dotdeb(您从哪里获得它们?),而且您似乎还禁用了 Ubuntu 存储库(否则,我认为libapache2-mod-php5会尝试将所有软件包降级为可与其配合使用的版本)。

您有两个选择:

  • 不要安装这些~dotdeb软件包,而是安装原装的 Ubuntu 版本(再次强调,不确定你从哪里获得这些软件包~dotdeb以及为什么需要它们;这实际上由你自己决定)。
  • libapache2-mod-php5从您获取 ~dotdeb 包的同一位置进行安装,该版本应该可以与它们很好地兼容。

也许问题在于您的 vagrant box 是预先构建的并且已经包含了那些 ~dotdeb,在这种情况下我真的建议您获取另一个使用官方 Ubuntu 软件包构建的 vagrant box,这将更容易使用。

相关内容