PHP version for Amazon Linux is reset to 5.6 after installing 7.0

I use Amazon Linux AMI and I uninstall PHP 5.6 and some extensions, and then install PHP 7.0 and some extensions. All this works fine for several weeks, and then all of a sudden, PHP 5.6 and the extensions I had before I installed it again without doing anything (as far as I can tell) to trigger this. It seems to happen by accident on some of my servers, but not on others.

Here is my YUM magazine:

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 

So, PHP 5.6 was deleted on April 3rd, and then installed on April 26th. However, the website only "switched" to PHP 5.6 on April 30th.

On another server, I have this log, which shows that some updates also started automatically:

 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 

Does YUM on Amazon Linux have automatic updates by default? If so, why reinstall the packages that I removed, and how can I prevent this?

+5
source share
1 answer

From what we commented on, I see that PHP7 is still installed, but PHP5.6 is installed the same way as for the other.

If you are using PHP 7 as the apache module, the first thing you need to do is replace it.

Somewhere in the file / etc / httpd or / etc / apache2 there should be a file that should look something like this:

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

Comment php5, add / uncomment php7. Check the correct paths.

Then restart the Apache web server with:

 service httpd restart 

or

 service apache2 restart 

Then, just out of curiosity, try uninstalling PHP 5.6 and you'll probably see the dependency.

Since you probably need to save PHP 5.6, check here how to freeze package updates
https://access.redhat.com/solutions/10185

edit /etc/yum.conf and add

 exclude=php* 

then you can do a yum update to check what happens.

If this is a live server that should not be stopped, be careful because errors in some steps can cause the web server to be deleted.

0
source

Source: https://habr.com/ru/post/1267327/


All Articles