本機版本查看:
$ dpkg -l | grep php7.0(軟件包名躺孝,版本,架構(gòu))
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