我在使用 ubuntu 21.10 impish 版本时遇到了很多问题?每次我们更新 ubuntu 时我们的 php 或 apache2 环境都会卡住吗?

我在使用 ubuntu 21.10 impish 版本时遇到了很多问题?每次我们更新 ubuntu 时我们的 php 或 apache2 环境都会卡住吗?

最近我将我的 ubuntu 21.04 升级到了 21.10。更新完成后,我收到一条通知,提示您已保留损坏的软件包以供解决,请使用部分更新。我再次更新时收到错误或新更新,例如大约 12 mb 的更新。我开始升级时收到此信息

Package dependencies cannot be resolved

This error could be caused by required additional software packages which are missing or not installable. Furthermore there could be a conflict between software packages which are not allowed to be installed at the same time.
Transaction failed: Package dependencies cannot be resolved
    The following packages have unmet dependencies:

php7.2-cli: Depends: libpcre3 (>= 2:8.41) but 2:8.44-2+ubuntu20.10.1+deb.sury.org+1 is to be installed
Depends: php7.2-common (= 7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) but 7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 is to be installed
Depends: zlib1g (>= 1:1.1.4) but 1:1.2.11.dfsg-2ubuntu7 is to be installed

我不明白为什么每次我们都只能使用 php。我是一名 Web 开发人员,在一家初创公司工作,他们在 php7.2 上有很多项目。现在每次更新我都会遇到问题,例如 composer 包问题、php 版本问题以及最后的 apache2 问题。

我想问你为什么ubuntu不支持php版本

顺便说一下,这是我的问题。

  1. Apache2 无法启动

    Job for apache2.service failed because the control process exited with error code.
    See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.
    apache-htcacheclean.service is a disabled or a static unit not running, not starting it.
    Processing triggers for man-db (2.9.4-2) ...
    Processing triggers for ufw (0.36.1-1) ...
    Rules updated for profile 'Apache'
    Rules updated for profile 'Apache Full'
    Firewall reloaded
    
  2. 我尝试通过终端解决我得到了这个

    sudo apt-get upgrade
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    Calculating upgrade... Done
    The following packages have been kept back:
      php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.2-intl php7.2-json
      php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml
      php7.2-zip
    0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded
    
  3. 我用过这个

    $ sudo apt-get install -f
    
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.`
    
  4. 然后我尝试了这个

    $ sudo dpkg --configure -a
    
    $ sudo apt-get install -f
    
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded
    

这是我的系统升级时的 term.log

Log started: 2021-10-10  01:46:59 dpkg: warning: downgrading php7.2-zip from 7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to
7.2.34-23+ubuntu21.04.1+deb.sury.org+1 (Reading database ...  (Reading database ... 5% (Reading database ... 10% (Reading database ... 15%
(Reading database ... 20% (Reading database ... 25% (Reading database
... 30% (Reading database ... 35% (Reading database ... 40% (Reading
database ... 45% (Reading database ... 50% (Reading database ... 55%
(Reading database ... 60% (Reading database ... 65% (Reading database
... 70% (Reading database ... 75% (Reading database ... 80% (Reading
database ... 85% (Reading database ... 90% (Reading database ... 95%
(Reading database ... 100% (Reading database ... 262970 files and
directories currently installed.) Preparing to unpack
.../00-php7.2-zip_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.2-zip (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) over
(7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-xml from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../01-php7.2-xml_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.2-xml (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) over
(7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-readline from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../02-php7.2-readline_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb
... Unpacking php7.2-readline (7.2.34-23+ubuntu21.04.1+deb.sury.org+1)
over (7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-opcache from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../03-php7.2-opcache_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb
... Unpacking php7.2-opcache (7.2.34-23+ubuntu21.04.1+deb.sury.org+1)
over (7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-mysql from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../04-php7.2-mysql_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb
... Unpacking php7.2-mysql (7.2.34-23+ubuntu21.04.1+deb.sury.org+1)
over (7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-mbstring from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../05-php7.2-mbstring_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb
... Unpacking php7.2-mbstring (7.2.34-23+ubuntu21.04.1+deb.sury.org+1)
over (7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-json from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../06-php7.2-json_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb
... Unpacking php7.2-json (7.2.34-23+ubuntu21.04.1+deb.sury.org+1)
over (7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-cli from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../07-php7.2-cli_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.2-cli (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) over
(7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-fpm from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../08-php7.2-fpm_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.2-fpm (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) over
(7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-intl from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../09-php7.2-intl_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb
... Unpacking php7.2-intl (7.2.34-23+ubuntu21.04.1+deb.sury.org+1)
over (7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... dpkg: warning:
downgrading php7.2-common from
7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00 to 7.2.34-23+ubuntu21.04.1+deb.sury.org+1 Preparing to unpack .../10-php7.2-common_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb
... Unpacking php7.2-common (7.2.34-23+ubuntu21.04.1+deb.sury.org+1)
over (7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00) ... (Reading
database ...  (Reading database ... 5% (Reading database ... 10%
(Reading database ... 15% (Reading database ... 20% (Reading database
... 25% (Reading database ... 30% (Reading database ... 35% (Reading
database ... 40% (Reading database ... 45% (Reading database ... 50%
(Reading database ... 55% (Reading database ... 60% (Reading database
... 65% (Reading database ... 70% (Reading database ... 75% (Reading
database ... 80% (Reading database ... 85% (Reading database ... 90%
(Reading database ... 95% (Reading database ... 100% (Reading database
... 262971 files and directories currently installed.) Removing
libicu65:amd64 (65.1-1+0~20200223.8+debian9~1.gbp519cf3) ... Selecting
previously unselected package php7.2-curl. (Reading database ... 
(Reading database ... 5% (Reading database ... 10% (Reading database
... 15% (Reading database ... 20% (Reading database ... 25% (Reading
database ... 30% (Reading database ... 35% (Reading database ... 40%
(Reading database ... 45% (Reading database ... 50% (Reading database
... 55% (Reading database ... 60% (Reading database ... 65% (Reading
database ... 70% (Reading database ... 75% (Reading database ... 80%
(Reading database ... 85% (Reading database ... 90% (Reading database
... 95% (Reading database ... 100% (Reading database ... 262955 files
and directories currently installed.) Preparing to unpack
.../php7.2-curl_7.2.34-23+ubuntu21.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.2-curl (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ...
Setting up php7.2-common (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ...
Setting up php7.2-opcache (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ...
Setting up php7.2-zip (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ...
Setting up php7.2-curl (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ...

Creating config file /etc/php/7.2/mods-available/curl.ini with new
version Setting up php7.2-json
(7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... Setting up php7.2-mysql
(7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... Setting up
php7.2-mbstring (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... Setting
up php7.2-intl (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... Setting up
php7.2-xml (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... Setting up
php7.2-readline (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... Setting
up php7.2-cli (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... Setting up
php7.2-fpm (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... 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. Processing triggers for libc-bin
(2.33-0ubuntu5) ... Processing triggers for man-db (2.9.4-2) ...
Processing triggers for php7.2-cli
(7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... Processing triggers for
php7.2-fpm (7.2.34-23+ubuntu21.04.1+deb.sury.org+1) ... 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. Log ended: 2021-10-10  01:49:13

这是我的 debian php 搜索结果

dpkg -l | grep -E "sury|debian9" 
rc  libapache2-mod-php7.2 7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        server-side, HTML-embedded scripting language (Apache 2 module) 
ii  libapr1:amd64 1.7.0-6+ubuntu20.10.1+deb.sury.org+2            amd64        Apache Portable Runtime Library ```
ii  libargon2-1:amd64                        0~20190702-0.1+0~20190710.3+debian9~1.gbp2fb167 amd64       memory-hard hashing function - runtime library 
ii  libbrotli-dev:amd64 1.0.9-2+ubuntu20.10.1+deb.sury.org+1            amd64        library implementing brotli encoder and decoder (development files) I need only php7.2 and apache2. I was frustrated and manually deleted some php versions directory so i can't purge now.
ii  libbrotli1:amd64                         1.0.9-2+ubuntu20.10.1+deb.sury.org+1            amd64        library implementing brotli encoder and decoder (shared libraries) 
ii  libicu65:amd64                          65.1-1+0~20200223.8+debian9~1.gbp519cf3         amd64        International Components for Unicode It happens because i have multiple php versions like php7.2 , php7.4 and php8.0. I upgraded from software update GUI. I thoughti was easy but i mistaken.
ii  libpcre16-3:amd64            2:8.44-2+ubuntu20.10.1+deb.sury.org+1           amd64        Perl 5 Compatible Regular Expression Library - 16 bit runtime files 
ii  libpcre2-16-0:amd64                          10.38-2+ubuntu21.04.1+deb.sury.org+1            amd64        New Perl Compatible Regular Expression Library - 16 bit runtime files 
ii  libpcre2-32-0:amd64                          10.38-2+ubuntu21.04.1+deb.sury.org+1            amd64        New Perl Compatible Regular Expression Library - 32 bit runtime files 
ii  libpcre2-8-0:amd64                           10.38-2+ubuntu21.04.1+deb.sury.org+1            amd64        New Perl Compatible Regular Expression Library- 8 bit runtime files 
ii  libpcre2-dev:amd64                           10.38-2+ubuntu21.04.1+deb.sury.org+1            amd64        New Perl Compatible Regular Expression Library - development files 
ii  libpcre2-posix2:amd64                        10.38-2+ubuntu21.04.1+deb.sury.org+1            amd64        New Perl Compatible Regular Expression Library - posix-compatible runtime files
ii  libpcre3:amd64                               2:8.44-2+ubuntu20.10.1+deb.sury.org+1           amd64        Perl 5 Compatible Regular Expression Library - runtime files 
ii  libpcre3-dev:amd64                           2:8.44-2+ubuntu20.10.1+deb.sury.org+1           amd64        Perl 5 Compatible Regular Expression Library - development files 
ii  libpcre32-3:amd64                            2:8.44-2+ubuntu20.10.1+deb.sury.org+1           amd64        Perl 5 Compatible Regular Expression Library - 32 bit runtime files 
ii  libpcrecpp0v5:amd64                          2:8.44-2+ubuntu20.10.1+deb.sury.org+1           amd64        Perl 5 Compatible Regular Expression Library - C++ runtime files 
ii  libsodium23:amd64                            1.0.18-1+0~20191009.1+debian9~1.gbpb6823f       amd64        Network communication, cryptography and signaturing library 
ii  libzip4:amd64  1.7.3-1+0~20210114.10+debian9~1.gbp4c125d       amd64        library for reading, creating, and modifying zip archives (runtime) 
ii  php-common                                   2:84+ubuntu21.04.1+deb.sury.org+1               all          Common files for PHP packages 
ii  php-curl                                    2:8.0+84+ubuntu21.04.1+deb.sury.org+1           all          CURL module for PHP [default] 
ii  php7.0-cli                                7.0.33-54+ubuntu21.04.1+deb.sury.org+1          amd64        command-line interpreter for the PHP scripting language 
ii  php7.0-common                                 7.0.33-54+ubuntu21.04.1+deb.sury.org+1          amd64        documentation, examples and common module for PHP 
ii  php7.0-json      7.0.33-54+ubuntu21.04.1+deb.sury.org+1          amd64        JSON module for PHP 
ii  php7.0-opcache                                7.0.33-54+ubuntu21.04.1+deb.sury.org+1          amd64        Zend OpCache module for PHP 
ii  php7.0-readline                             7.0.33-54+ubuntu21.04.1+deb.sury.org+1          amd64        readline module for PHP 
ii  php7.1-cli                                    7.1.33-41+ubuntu21.04.1+deb.sury.org+1          amd64        command-line interpreter for the PHP scripting language 
ii  php7.1-common                                 7.1.33-41+ubuntu21.04.1+deb.sury.org+1          amd64        documentation, examples and common module for PHP 
ii  php7.1-json      7.1.33-41+ubuntu21.04.1+deb.sury.org+1          amd64        JSON module for PHP 
ii  php7.1-opcache                                7.1.33-41+ubuntu21.04.1+deb.sury.org+1          amd64        Zend OpCache module for PHP 
ii  php7.1-readline                             7.1.33-41+ubuntu21.04.1+deb.sury.org+1          amd64        readline module for PHP rc  php7.2-cli                                    7.2.34-23+ubuntu21.04.1+deb.sury.org+1          amd64        command-line interpreter for the PHP scripting language 
ii  php7.2-common                                 7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        documentation, examples and common module for PHP rc  php7.2-curl      7.2.34-23+ubuntu21.04.1+deb.sury.org+1          amd64        CURL module for PHP rc  php7.2-fpm                                    7.2.34-23+ubuntu21.04.1+deb.sury.org+1          amd64        server-side, HTML-embedded scripting language (FPM-CGI binary) 
ii  php7.2-intl                                   7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        Internationalisation module for PHP 
ii  php7.2-json                    7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        JSON module for PHP 
ii  php7.2-mbstring                               7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        MBSTRING module for PHP 
ii  php7.2-mysql                                  7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        MySQL module for PHP 
ii  php7.2-opcache                                7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        Zend OpCache module for PHP rc  php7.2-readline                             7.2.34-23+ubuntu21.04.1+deb.sury.org+1          amd64        readline module for PHP 
ii  php7.2-xml                                    7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP 
ii  php7.2-zip            7.2.34-25+0~20210923.65+debian9~1.gbpa3cd00     amd64        Zip module for PHP 
ii  php7.3-cli                                    7.3.31-1+ubuntu21.04.1+deb.sury.org+1           amd64        command-line interpreter for the PHP scripting language 
ii  php7.3-common                                 7.3.31-1+ubuntu21.04.1+deb.sury.org+1           amd64        documentation, examples and common module for PHP 
ii  php7.3-json      7.3.31-1+ubuntu21.04.1+deb.sury.org+1           amd64        JSON module for PHP 
ii  php7.3-opcache                                7.3.31-1+ubuntu21.04.1+deb.sury.org+1           amd64        Zend OpCache module for PHP 
ii  php7.3-readline                             7.3.31-1+ubuntu21.04.1+deb.sury.org+1           amd64        readline module for PHP 
ii  php7.4-cli                                    7.4.24-1+ubuntu21.04.1+deb.sury.org+1           amd64        command-line interpreter for the PHP scripting language 
ii  php7.4-common                                 7.4.24-1+ubuntu21.04.1+deb.sury.org+1           amd64        documentation, examples and common module for PHP rc  php7.4-gd        7.4.24-1+ubuntu21.04.1+deb.sury.org+1           amd64        GD module for PHP 
ii  php7.4-json                                   7.4.24-1+ubuntu21.04.1+deb.sury.org+1           amd64        JSON module for PHP 
ii  php7.4-mysql                                  7.4.24-1+ubuntu21.04.1+deb.sury.org+1           amd64        MySQL module for PHP 
ii  php7.4-opcache                                7.4.24-1+ubuntu21.04.1+deb.sury.org+1           amd64        Zend OpCache module for PHP 
ii  php7.4-readline                             7.4.24-1+ubuntu21.04.1+deb.sury.org+1           amd64        readline module for PHP rc  php7.4-xml                                    7.4.24-1+ubuntu21.04.1+deb.sury.org+1           amd64        DOM, SimpleXML, XML, and XSL module for PHP 
ii  php8.0-common               8.0.11-1+ubuntu21.04.1+deb.sury.org+1           amd64        documentation, examples and common module for PHP 
ii  php8.0-curl      8.0.11-1+ubuntu21.04.1+deb.sury.org+1           amd64        CURL module for PHP 
rc  php8.0-gd                                     8.0.11-1+ubuntu21.04.1+deb.sury.org+1           amd64        GD module for PHP 
rc  php8.0-mysql                                  8.0.11-1+ubuntu21.04.1+deb.sury.org+1           amd64        MySQL module for PHP 
rc  php8.0-xml                                    8.0.11-1+ubuntu21.04.1+deb.sury.org+1           amd64        DOM, SimpleXML, XML, and XSL module for PHP

我只需要 php7.2 和 apache2。我很沮丧,手动删除了一些 php 版本目录,所以现在无法清除。

发生这种情况是因为我有多个 php 版本,例如 php7.2、php7.4 和 php8.0。我从软件更新 GUI 升级。我以为这很容易,但我错了。

相关内容