无法在 Ubuntu 16.04.1 LTS 上安装 php-mbstring

无法在 Ubuntu 16.04.1 LTS 上安装 php-mbstring

我无法安装 php-mbstring,命令结果如下:

# apt install php-mbstring
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:
 php-mbstring : Depends: php7.0-mbstring but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

系统信息:

# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"

安装的PHP包:

# dpkg -l |grep php
ii  libapache2-mod-php                   1:7.0+35ubuntu6                  all          server-side, HTML-embedded scripting language (Apache 2 module) (default)
ii  libapache2-mod-php7.0                7.0.8-0ubuntu0.16.04.3           amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php                                  1:7.0+35ubuntu6                  all          server-side, HTML-embedded scripting language (default)
ii  php-cli-prompt                       1.0.1+dfsg-1build1               all          tiny helper prompting for user input
ii  php-common                           1:35ubuntu6                      all          Common files for PHP packages
ii  php-composer-semver                  1.2.0-1build1                    all          Semver library that offers utilities, version constraint parsing and
ii  php-composer-spdx-licenses           1.1.2-1build1                    all          SPDX licenses list and validation library
ii  php-curl                             1:7.0+35ubuntu6                  all          CURL module for PHP [default]
ii  php-gettext                          1.0.11-2build1                   all          read gettext MO files directly, without requiring anything other than PHP
ii  php-json-schema                      1.6.1-1build1                    all          implementation of JSON schema
ii  php-mysql                            1:7.0+35ubuntu6                  all          MySQL module for PHP [default]
ii  php-pear                             1:1.10.1+submodules+notgz-6      all          PEAR Base System
ii  php-phpseclib                        2.0.1-1build1                    all          implementations of an arbitrary-precision integer arithmetic library
ii  php-symfony-console                  2.7.10-0ubuntu2                  all          run tasks from the command line
ii  php-symfony-filesystem               2.7.10-0ubuntu2                  all          basic filesystem utilities
ii  php-symfony-finder                   2.7.10-0ubuntu2                  all          find files and directories
ii  php-symfony-process                  2.7.10-0ubuntu2                  all          execute commands in sub-processes
ii  php-xml                              1:7.0+35ubuntu6                  all          DOM, SimpleXML, WDDX, XML, and XSL module for PHP [default]
ii  php7.0                               7.0.8-0ubuntu0.16.04.3           all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.0-cli                           7.0.8-0ubuntu0.16.04.3           amd64        command-line interpreter for the PHP scripting language
ii  php7.0-common                        7.0.8-0ubuntu0.16.04.3           amd64        documentation, examples and common module for PHP
ii  php7.0-curl                          7.0.8-0ubuntu0.16.04.3           amd64        CURL module for PHP
ii  php7.0-json                          7.0.8-0ubuntu0.16.04.3           amd64        JSON module for PHP
ii  php7.0-mysql                         7.0.8-0ubuntu0.16.04.3           amd64        MySQL module for PHP
ii  php7.0-opcache                       7.0.8-0ubuntu0.16.04.3           amd64        Zend OpCache module for PHP
ii  php7.0-readline                      7.0.8-0ubuntu0.16.04.3           amd64        readline module for PHP
ii  php7.0-xml                           7.0.8-0ubuntu0.16.04.3           amd64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  phpmyadmin                           4:4.5.4.1-2ubuntu1               all          MySQL web administration tool

所有来源都是最新的和升级的:

# apt update 
Get:1 https://mirrors.gandi.net/ubuntu xenial-backports InRelease [92.2 kB]
Hit:1 https://mirrors.gandi.net/ubuntu xenial-backports InRelease
Ign:2 https://mirrors.gandi.net/gandi/ubuntu xenial InRelease
Hit:3 https://mirrors.gandi.net/ubuntu xenial-proposed InRelease
Hit:4 https://mirrors.gandi.net/ubuntu xenial-security InRelease
Hit:5 https://mirrors.gandi.net/ubuntu xenial-updates InRelease
Get:6 https://mirrors.gandi.net/ubuntu xenial InRelease [247 kB]
Hit:6 https://mirrors.gandi.net/ubuntu xenial InRelease  
Hit:7 https://mirrors.gandi.net/gandi/ubuntu xenial Release
Get:8 https://mirrors.gandi.net/gandi/ubuntu xenial Release.gpg [198 B]
Fetched 198 B in 1s (161 B/s)       
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: https://mirrors.gandi.net/gandi/ubuntu/dists/xenial/Release.gpg: Signature by key 52596D104900956B55AA8A0ED8EAC2F4DAFE3FA5 uses weak digest algorithm (SHA1)
# apt dist-upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

我不知道该如何处理,谢谢你的支持。David


我曾尝试使用官方的 ubuntu 镜像,但没有成功:

# apt update 
Hit:1 http://fr.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:3 http://fr.archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://fr.archive.ubuntu.com/ubuntu xenial-proposed InRelease
Hit:5 http://fr.archive.ubuntu.com/ubuntu xenial-updates InRelease
Reading package lists... Done                      
Building dependency tree       
Reading state information... Done
All packages are up to date.


# apt install libapache2-mod-php7.0 phpmyadmin php7.0-mbstring
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.0-mbstring : Depends: php7.0-common (= 7.0.4-7ubuntu2) but 7.0.8-0ubuntu0.16.04.3 is to be installed
E: Unable to correct problems, you have held broken packages.

我不知道该如何处理它...:(

有什么想法吗?谢谢帮助。

大卫

答案1

我找到的解决方案:在 xenial-updates 上添加了“universe”

# cat /etc/apt/sources.list.d/*
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-backports main
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial main universe
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-proposed main
deb [arch=amd64] http://security.ubuntu.com/ubuntu xenial-security main
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-updates main universe

相关内容