安装7.0后,Amazon Linux PHP版本重置为5.6

时间:2017-04-30 08:04:15

标签: php-7 yum php-5.6 amazon-linux

我正在使用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是否已启用自动更新?如果是这样,为什么要重新安装我卸载的软件包?如何防止这种情况?

1 个答案:

答案 0 :(得分: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 webserver

service httpd restart

service apache2 restart

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

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

修改/etc/yum.conf并添加

exclude=php*

然后你可以做yum更新只是为了检查会发生什么。

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