为什么安装 php5-memcache 会导致 php 版本从 5.5.9 升级到 7.0.x?

为什么安装 php5-memcache 会导致 php 版本从 5.5.9 升级到 7.0.x?

我正在尝试安装 php 5.5 + memcache PHP 扩展

Ubuntu Trusty(14.04)

$ apt-get install php5
Reading package lists... Done
[...]
Setting up php5 (5.5.9+dfsg-1ubuntu4.20) ...

$ apt-get install php5-memcache
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libmcrypt4
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  php-cli php-common php-pear php-xml php7.0-cli php7.0-common php7.0-json
  php7.0-opcache php7.0-readline php7.0-xml
Suggested packages:
  memcached
The following NEW packages will be installed:
  php-cli php-common php-pear php-xml php5-memcache php7.0-cli php7.0-common
  php7.0-json php7.0-opcache php7.0-readline php7.0-xml
0 upgraded, 11 newly installed, 0 to remove and 17 not upgraded.
Need to get 2,725 kB of archives.
After this operation, 12.8 MB of additional disk space will be used.
Do you want to continue? [Y/n]

如您所见,额外的 PHP 7.0 扩展存在问题:

php7.0-cli
php7.0-common 
php7.0-json
php7.0-opcache
php7.0-readline
php7.0-xml

安装后,我得到的是 PHP 7.0,而不是 5.5。

如何避免升级 PHP?

答案1

所以,我不知道为什么会发生这种情况,但似乎只有两个 PHP 版本 7.0 和 5.5.9。

重写命令的快速解决方案php是更新符号链接:

$ ln -sf /usr/bin/php5 /etc/alternatives/php

答案2

我建议只升级您需要升级的内容。

apt-get install --only-upgrade <packagename>

相关内容