5

我正在使用 Amazon Linux AMI,我卸载 PHP 5.6 和一些扩展,然后安装 PHP 7.0 和一些扩展。这一切都可以正常工作几个星期,然后突然 PHP 5.6 和我之前拥有的扩展再次安装,而我没有做任何事情(据我所知)导致这种情况。这似乎在我的一些服务器上随机发生,但在其他服务器上却没有。

这是我的 YUM 日志:

Apr 03 14:58:53 Erased: php56-5.6.30-1.133.amzn1.x86_64
Apr 03 14:58:53 Erased: php56-mysqlnd-5.6.30-1.133.amzn1.x86_64
Apr 03 14:58:53 Erased: php56-pdo-5.6.30-1.133.amzn1.x86_64
Apr 03 14:58:53 Erased: php56-xml-5.6.30-1.133.amzn1.x86_64
Apr 03 14:58:53 Erased: php56-cli-5.6.30-1.133.amzn1.x86_64
Apr 03 14:58:53 Erased: php56-jsonc-1.3.6-1.19.amzn1.x86_64
Apr 03 14:58:53 Erased: php56-common-5.6.30-1.133.amzn1.x86_64
Apr 03 14:58:53 Erased: php56-process-5.6.30-1.133.amzn1.x86_64
Apr 03 14:59:12 Installed: php70-json-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:12 Installed: php70-process-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:12 Installed: php70-cli-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:12 Installed: php70-xml-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:12 Installed: php70-common-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-pdo-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-pecl-igbinary-1.2.2-0.1.20151217git2b7c703.5.amzn1.x86_64
Apr 03 14:59:13 Installed: libXpm-3.5.10-2.9.amzn1.x86_64
Apr 03 14:59:13 Installed: libwebp-0.3.0-3.5.amzn1.x86_64
Apr 03 14:59:13 Installed: 12:aspell-0.60.6-12.7.amzn1.x86_64
Apr 03 14:59:13 Installed: libmcrypt-2.5.8-9.1.2.amzn1.x86_64
Apr 03 14:59:13 Installed: libmemcached-1.0.16-5.8.amzn1.x86_64
Apr 03 14:59:13 Installed: libtool-ltdl-2.4.2-20.4.8.3.31.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-mcrypt-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-pecl-memcached-3.0.0-0.1.20160217git6ace07d.2.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-pspell-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-gd-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-mysqlnd-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-intl-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-mbstring-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-opcache-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-soap-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-zip-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:13 Installed: php70-xmlrpc-7.0.16-1.21.amzn1.x86_64
Apr 03 14:59:51 Updated: 1:openssl-1.0.1k-15.99.amzn1.x86_64
Apr 03 14:59:52 Updated: krb5-libs-1.14.1-27.41.amzn1.x86_64
Apr 03 14:59:52 Installed: libkadm5-1.14.1-27.41.amzn1.x86_64
Apr 03 14:59:52 Installed: libverto-devel-0.2.5-4.9.amzn1.x86_64
Apr 03 14:59:52 Installed: libcom_err-devel-1.42.12-4.40.amzn1.x86_64
Apr 03 14:59:52 Installed: zlib-devel-1.2.8-7.18.amzn1.x86_64
Apr 03 14:59:52 Installed: keyutils-libs-devel-1.5.8-3.12.amzn1.x86_64
Apr 03 14:59:52 Installed: libsepol-devel-2.1.7-3.12.amzn1.x86_64
Apr 03 14:59:52 Installed: libselinux-devel-2.1.10-3.22.amzn1.x86_64
Apr 03 14:59:52 Installed: krb5-devel-1.14.1-27.41.amzn1.x86_64
Apr 03 14:59:52 Installed: 1:openssl-devel-1.0.1k-15.99.amzn1.x86_64
Apr 03 14:59:52 Installed: mysql55-devel-5.5.54-1.16.amzn1.x86_64
Apr 03 14:59:52 Installed: mysql-devel-5.5-1.6.amzn1.noarch
Apr 03 15:00:06 Updated: glibc-2.17-157.169.amzn1.x86_64
Apr 03 15:00:10 Updated: glibc-common-2.17-157.169.amzn1.x86_64
Apr 03 15:00:10 Installed: mpfr-3.1.1-4.14.amzn1.x86_64
Apr 03 15:00:10 Installed: libmpc-1.0.1-3.3.amzn1.x86_64
Apr 03 15:00:10 Installed: cpp48-4.8.3-9.111.amzn1.x86_64
Apr 03 15:00:10 Installed: libgomp-4.8.3-9.111.amzn1.x86_64
Apr 03 15:00:10 Installed: kernel-headers-4.4.51-40.60.amzn1.x86_64
Apr 03 15:00:10 Installed: glibc-headers-2.17-157.169.amzn1.x86_64
Apr 03 15:00:10 Installed: glibc-devel-2.17-157.169.amzn1.x86_64
Apr 03 15:00:11 Installed: gcc48-4.8.3-9.111.amzn1.x86_64
Apr 03 15:00:11 Installed: gcc-4.8.3-3.20.amzn1.noarch
Apr 03 15:04:31 Installed: sysstat-9.0.4-27.10.amzn1.x86_64
Apr 03 15:07:45 Installed: newrelic-repo-5-3.noarch
Apr 03 15:07:53 Installed: newrelic-sysmond-2.3.0.132-1.x86_64
Apr 03 15:08:29 Installed: newrelic-php5-common-7.1.0.187-1.noarch
Apr 03 15:08:29 Installed: newrelic-daemon-7.1.0.187-1.x86_64
Apr 03 15:08:29 Installed: newrelic-php5-7.1.0.187-1.x86_64
Apr 03 15:09:18 Installed: python26-2.6.9-2.88.amzn1.x86_64
Apr 03 15:09:18 Installed: python26-libs-2.6.9-2.88.amzn1.x86_64
Apr 03 15:09:18 Installed: python26-backports-1.0-3.14.amzn1.x86_64
Apr 03 15:09:18 Installed: python26-backports-ssl_match_hostname-3.4.0.2-1.12.amzn1.noarch
Apr 03 15:09:18 Installed: python26-setuptools-12.2-1.32.amzn1.noarch
Apr 03 15:09:18 Installed: logentries-1.4.41-1484859727.x86_64
Apr 03 15:09:26 Installed: logentries-daemon-0.8.6-1.x86_64
Apr 04 08:34:19 Erased: newrelic-php5-7.1.0.187-1.x86_64
Apr 04 08:34:23 Installed: newrelic-php5-7.1.0.187-1.x86_64
Apr 04 10:04:04 Erased: newrelic-php5-7.1.0.187-1.x86_64
Apr 04 10:04:08 Installed: newrelic-php5-7.1.0.187-1.x86_64
Apr 05 09:07:39 Erased: newrelic-php5-7.1.0.187-1.x86_64
Apr 05 09:07:43 Installed: newrelic-php5-7.1.0.187-1.x86_64
Apr 26 06:49:46 Erased: newrelic-php5-7.1.0.187-1.x86_64
Apr 26 06:49:50 Updated: newrelic-php5-common-7.2.0.191-1.noarch
Apr 26 06:49:50 Updated: newrelic-daemon-7.2.0.191-1.x86_64
Apr 26 06:49:50 Installed: newrelic-php5-7.2.0.191-1.x86_64
Apr 26 12:29:52 Erased: newrelic-php5-7.2.0.191-1.x86_64
Apr 26 12:29:55 Installed: newrelic-php5-7.2.0.191-1.x86_64
Apr 26 12:53:07 Installed: php56-jsonc-1.3.6-1.19.amzn1.x86_64
Apr 26 12:53:07 Installed: php56-cli-5.6.30-1.133.amzn1.x86_64
Apr 26 12:53:07 Installed: php56-xml-5.6.30-1.133.amzn1.x86_64
Apr 26 12:53:07 Installed: php56-common-5.6.30-1.133.amzn1.x86_64
Apr 26 12:53:08 Installed: php56-process-5.6.30-1.133.amzn1.x86_64
Apr 26 12:53:08 Installed: php56-pdo-5.6.30-1.133.amzn1.x86_64
Apr 26 12:53:08 Installed: php56-mysqlnd-5.6.30-1.133.amzn1.x86_64
Apr 26 12:53:08 Installed: php56-5.6.30-1.133.amzn1.x86_64

因此 PHP 5.6 在 4 月 3 日被删除,然后在 4 月 26 日再次安装。然而,该网站仅在 4 月 30 日“切换”回 PHP 5.6。

在另一台服务器上,我有这个日志,它显示一些更新也被自动启动:

Apr 30 04:14:00 Updated: nspr-4.13.1-1.0.39.amzn1.x86_64
Apr 30 04:14:00 Updated: nss-util-3.28.4-1.0.52.amzn1.x86_64
Apr 30 04:14:00 Updated: nss-sysinit-3.28.4-1.0.78.amzn1.x86_64
Apr 30 04:14:00 Updated: nss-3.28.4-1.0.78.amzn1.x86_64
Apr 30 04:14:00 Updated: 32:bind-libs-9.8.2-0.62.rc1.54.amzn1.x86_64
Apr 30 04:14:01 Updated: 32:bind-utils-9.8.2-0.62.rc1.54.amzn1.x86_64
Apr 30 04:14:01 Updated: nss-tools-3.28.4-1.0.78.amzn1.x86_64
Apr 30 04:14:55 Installed: php56-jsonc-1.3.6-1.19.amzn1.x86_64
Apr 30 04:14:56 Installed: php56-cli-5.6.30-1.133.amzn1.x86_64
Apr 30 04:14:56 Installed: php56-xml-5.6.30-1.133.amzn1.x86_64
Apr 30 04:14:56 Installed: php56-common-5.6.30-1.133.amzn1.x86_64
Apr 30 04:14:56 Installed: php56-process-5.6.30-1.133.amzn1.x86_64
Apr 30 04:14:56 Installed: php56-pdo-5.6.30-1.133.amzn1.x86_64
Apr 30 04:14:56 Installed: php56-mysqlnd-5.6.30-1.133.amzn1.x86_64
Apr 30 04:14:56 Installed: php56-5.6.30-1.133.amzn1.x86_64

Amazon Linux 上的 YUM 是否默认开启了自动更新?如果是这样,为什么它会重新安装我卸载的软件包,我该如何防止呢?

4

1 回答 1

0

根据我们的评论,我看到仍然安装了 PHP7,但是安装了 PHP5.6 以及其他东西的依赖项。

如果您使用 PHP 7 作为 apache 模块,您需要做的第一件事就是替换它。

在 /etc/httpd 或 /etc/apache2 中的某处,应该有一个看起来像这样的文件:

#LoadModule php5_module                 modules/libphp5.so
LoadModule php7_module                  modules/libphp7.so

注释掉 php5,添加/取消注释 php7。检查正确的路径。

然后使用以下命令重新启动 Apache 网络服务器:

service httpd restart

或者

service apache2 restart

然后,出于好奇,尝试卸载 PHP 5.6,您可能会看到依赖项。

因为您可能需要保留 PHP 5.6,请在此处查看如何冻结软件包升级
https://access.redhat.com/solutions/10185

编辑/etc/yum.conf并添加

exclude=php*

然后你可以做 yum update 来检查会发生什么。

如果这是不能停止的实时服务器,请格外小心,因为某些步骤中的错误可能会导致网络服务器停机。

于 2017-04-30T10:49:20.653 回答