本机版本查看:
$ dpkg -l | grep php7.0(软件包名,版本,架构)
ii php7.0 7.0.15-0ubuntu0.16.04.4 all server-side, HTML-embedded scripting language (metapackage)
...
apt-get install php7.0-zip 默认安装最新版本 7.0.18,本机是 7.0.15 版本,显示需要升级很多依赖:
$ sudo apt-get install php7.0-zip
The following additional packages will be installed:
php7.0 php7.0-bcmath php7.0-bz2 php7.0-cli php7.0-common php7.0-curl
php7.0-fpm php7.0-gd php7.0-json php7.0-ldap php7.0-mbstring php7.0-mysql
php7.0-opcache php7.0-readline php7.0-sqlite3 php7.0-xml
The following packages will be upgraded:
php7.0 php7.0-bcmath php7.0-bz2 php7.0-cli php7.0-common php7.0-curl
php7.0-fpm php7.0-gd php7.0-json php7.0-ldap php7.0-mbstring php7.0-mysql
php7.0-opcache php7.0-readline php7.0-sqlite3 php7.0-xml php7.0-zip
17 upgraded, 0 newly installed, 0 to remove and 148 not upgraded.
准备升级的包有 php7.0,php7.0-fpm,这就是要把 php 整体升级了。
如果不想升级到 7.0.18 呢(暂时没必要),先查看提供安装的软件包(下面显示有三个版本)
$ apt-cache showpkg php-zip
...
Provides:
7.0.18-0ubuntu0.16.04.1 - php-zip (= )
7.0.15-0ubuntu0.16.04.4 - php-zip (= )
7.0.4-7ubuntu2 - php-zip (= )
看到有 7.0.15 版本的,那安装指定版本 7.0.15-0ubuntu0.16.04.4,显示不需要升级依赖:
apt-get install php-zip=7.0.15-0ubuntu0.16.04.4
这就可以了,使用 php -m 看下zip模块在不在:
$ php -m
...
xsl
Zend OPcache
zip
zlib