我最近将我的 ubuntu 服务器从 16.04 更新到 18.04,然后从 18.04 更新到 20.04。我设法升级到 20.04,但升级过程中出现了问题。现在根据我的研究和人们的说法,可能是损坏的软件包或残留文件导致了问题。我的 wp 网站上的两个插件显示未安装 curl,这就是我开始研究这个问题的地方。
输出dpkg -l 'php*'
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architectur>
+++-==================-============================================-===========>
ii php 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all >
un php-amqp <none> <none> >
ii php-apcu 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 >
ii php-apcu-bc 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 >
un php-ast <none> <none> >
ii php-bz2 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all >
un php-calendar <none> <none> >
un php-cli <none> <none> >
ii php-common 2:79+ubuntu16.04.1+deb.sury.org+4 all >
un php-crypt-gpg <none> <none> >
un php-ctype <none> <none> >
un php-curl <none> <none> >
un php-dom <none> <none> >
un php-exif <none> <none> >
un php-ffi <none> <none> >
un php-fileinfo <none> <none> >
un php-fpm <none> <none> >
un php-ftp <none> <none> >
输出dpkg -l '*curl*' | grep ^ii
ii libcurl3-gnutls:amd64 7.68.0-1ubuntu2.2 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour)
ii libcurl4:amd64 7.68.0-1ubuntu2.2 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)
ii python3-pycurl 7.43.0.2-1ubuntu5 amd64 Python bindings to libcurl (Python 3)
输出apt-cache policy php7.4-curl
php7.4-curl:
Installed: (none)
Candidate: 7.4.3-4ubuntu2.4
Version table:
7.4.12-3+ubuntu16.04.1+deb.sury.org+1 -1
100 /var/lib/dpkg/status
7.4.3-4ubuntu2.4 500
500 http://mirrors.digitalocean.com/ubuntu focal-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
7.4.3-4ubuntu1 500
500 http://mirrors.digitalocean.com/ubuntu focal/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
输出apt list --installed php*
php-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
php-bz2/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-common/now 2:79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-gd/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-gmp/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-json/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-mbstring/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-mysql/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-pspell/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-recode/now 1:7.2+60ubuntu1 all [installed,local]
php-soap/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-tidy/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-xml/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-xmlrpc/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php-zip/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
php5.6-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
php7.0-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
php7.0-bz2/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-cli/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-common/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-gd/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-gmp/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-json/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-mbstring/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-mysql/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-opcache/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-pspell/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-readline/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-soap/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-xml/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-xmlrpc/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0-zip/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.0/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 all [installed,local]
php7.1-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
php7.2-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.2-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
php7.2-common/now 7.2.24-0ubuntu0.18.04.7 amd64 [installed,local]
php7.2-recode/now 7.2.24-0ubuntu0.18.04.7 amd64 [installed,local]
php7.3-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
php7.3-cli/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-common/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-fpm/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-gd/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-json/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-mbstring/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-mysql/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-opcache/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-readline/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-xml/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-xmlrpc/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3-zip/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.3/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 all [installed,local]
php7.4-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
php7.4-bz2/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-cli/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-common/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-fpm/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-gd/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-gmp/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-json/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-mbstring/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-mysql/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-opcache/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-pspell/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-readline/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-soap/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-tidy/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-xml/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-xmlrpc/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4-zip/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
php7.4/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 all [installed,local]
php8.0-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
php/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
答案1
@rem3on 根据您对该问题的评论之一判断,仍安装有旧版本的 php7.4-common。要安装 php-curl,您还需要安装 php7.4-curl。这又依赖于 php7.4-common。在 Ubuntu 20.04 中,php7.4-common 对应于 7.4.3-4ubuntu2.4。但已经安装了“竞争”的 php7.4-common,即 7.4.12-3+ubuntu16.04.1+deb.sury.org+1。这看起来像是适用于 Ubuntu 16.04 的 PHP 7.4。– Henning Kockerbeck 14 小时前
在另一篇文章中再次查看 Henning Kockerbeck 的回答,我运行了 sudo apt-get purge php7.4-common,然后运行“sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath”问题已经解决,我现在没有收到 curl 丢失错误。虽然这个问题已经解决,但我必须确保服务器没有混乱,我现在能做什么来确保一切正常。此外,可能还有比 curl 丢失更多的问题,你能帮我解决吗?