php Ubuntu 18.04升级后php7.2-curl无法安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50242053/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
After Ubuntu 18.04 upgrade php7.2-curl cannot be installed
提问by Arni J
Upgraded to 18.04 from 16.04 today using do-release-upgrade -d
使用今天从 16.04 升级到 18.04 do-release-upgrade -d
During the upgrade I was informed that some packages would be removed, these included:
在升级过程中,我被告知将删除一些软件包,其中包括:
Remove: libperl5.22 lxc-common perl-modules-5.22 php-imagick
php7.1-curl php7.2-curl python3-certbot-nginx
删除:libperl5.22 lxc-common perl-modules-5.22 php-imagick
php7.1-curl php7.2-curl python3-certbot-nginx
I could re-install imagick and certbot without issue, but if I try to install php7.2-curl I get the message:
我可以毫无问题地重新安装 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.
How can I correct the situation?
我该如何纠正这种情况?
回答by Anson Wong
This can save you:
这可以为您节省:
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
Then sudo service apache2 restart
然后 sudo service apache2 restart
回答by J-a-n-u-s
You don't need to add a new repo. Just do this and the 7.2 version will be installed. Remember to restart php and apache after. Also make sure (you've prob already done this though) to enable the new mod after:
您不需要添加新的存储库。只需执行此操作即可安装 7.2 版本。之后记得重启php和apache。还要确保(您可能已经这样做了)在以下之后启用新模块:
sudo apt install php-curl
sudo a2enmod php7.2
You'll also notice probably that at the end of the install of php-curl
(which installs php-curl
and php7.2-curl
) the following (Note that I have FPM setup, might look different if you're not using FPM):
您可能还会注意到,在安装php-curl
(which installs php-curl
and php7.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.
So do what it says:
所以按照它说的去做:
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm
sudo systemctl restart apache2.service
回答by MickC
Installing libcurl4 worked for me using
安装 libcurl4 对我有用
apt install libcurl4
Then installed php7.2-curl, restarted apache2 without an issue.
然后安装 php7.2-curl,重新启动 apache2 没有问题。