安装php5-mcrypt时出错

时间:2015-05-17 09:33:54

标签: php ubuntu server google-compute-engine mcrypt

就在今天,我注册了Google Cloud Compute Engine。我做了所有事情,但在安装php5-mcrypt扩展程序时遇到了错误。 错误:

root@instance-2:~# sudo apt-get install php5-mcrypt
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-mcrypt : Depends: phpapi-20121212
               Depends: php5-common (= 5.5.24+dfsg-1+deb.sury.org~vivid+1) but 5.6.4+dfsg-4ubuntu6 is to be installed
E: Unable to correct problems, you have held broken packages.

我到处搜索,然后我来到这里。请帮忙。

3 个答案:

答案 0 :(得分:3)

sudo service apache2 restar

apt-get install php5-common 

或者,如果您不需要保持配置:

apt-get purge php5-common
apt-get install php5-common

您是否从apt-mark showhold获得了任何输出?

如果它无法解决您的问题,您应该尝试使用aptitude安装它:

sudo apt-get install aptitude
sudo aptitude install php5-mcrypt

最后重新加载服务器

sudo service apache2 restart

答案 1 :(得分:0)

有完全相同的问题。接受的解决方案对我不起作用。让我想起了一个方法。

expect

(警告:您将丢失PHP和Apache安装的所有设置!)

重装:

sudo add-apt-repository -r ppa:ondrej/php5
sudo add-apt-repository -r ppa:ondrej/php5-oldstable
sudo add-apt-repository -r ppa:ondrej/php5-5.6
sudo apt-get purge php5* apache2* mcrypt*
sudo apt-get update
sudo apt-get upgrade

并启用扩展程序

sudo apt-get install php5 php5-mcrypt php5-curl apache2

魔术。

答案 2 :(得分:0)

这太可怕了,太可怕了,太可怕了。将ppa:ondrej/php5-5.6ppa:ondrej/php5ppa:ondrej/php5-oldstable一起添加将完全没有任何内容,因为您只需要其中一个(因为其中包含PHP 5.4,第二个PHP 5.5和第三个PHP 5.6)。清除php5*apache2*也不是必需的,如果您遇到错误升级,可能需要清除apache2.2-common,但就是这样。然后mcryptcurl模块将自动启用(除非您过去已禁用它们),因此php5enmod mcryptphp5enmod curl是额外的(但无害)。< / p>