Ubuntu 18.04升级后无法安装php7.2-curl

时间:2018-05-08 20:49:18

标签: php apt php-curl ubuntu-18.04

使用do-release-upgrade -d

从今天16.04升级到18.04

在升级过程中,我被告知将删除一些软件包,其中包括:

  

删除:libperl5.22 lxc-common perl-modules-5.22 php-imagick
  php7.1-curl php7.2-curl python3-certbot-nginx

我可以毫无问题地重新安装imagick和certbot,但如果我尝试安装php7.2-curl,我会收到消息:

# apt install php7.2-curl -y
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-curl : Depends: php7.2-common (= 7.2.3-1ubuntu1) but 7.2.4-1+ubuntu16.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.

我该如何纠正这种情况?

3 个答案:

答案 0 :(得分:48)

这可以为您节省:

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2-fpm php7.2-gd php7.2-curl php7.2-mysql php7.2-dev php7.2-cli php7.2-common php7.2-mbstring php7.2-intl php7.2-zip php7.2-bcmath

然后sudo service apache2 restart

答案 1 :(得分:1)

您不需要添加新的仓库。只需执行此操作,即可安装7.2版本。切记重新启动php和之后的apache。还要确保(尽管您已经完成了此操作)在以下时间启用新的mod:

sudo apt install php-curl
sudo a2enmod php7.2

您还可能会注意到,在安装php-curl(安装php-curlphp7.2-curl结束时,以下内容(请注意,我安装了FPM,可能看起来有所不同)如果您不使用FPM):

NOTICE: Not enabling PHP 7.2 FPM by default.
NOTICE: To enable PHP 7.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.

按照它说的做

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm
sudo systemctl restart apache2.service

答案 2 :(得分:0)

安装libcurl4对我有用

apt install libcurl4

然后安装php7.2-curl,重新启动apache2,没有问题。