I needed try PHP 5.6 and 5.5 on on Centos 7. So, I installed them overtop of a perfect working installation of PHP 7.1. I followed the instructions here: https://www.mojowill.com/geek/howto-install-php-5-4-5-5-or-5-6-on-centos-6-and-centos-7/
Basically, I edited the remi repo config file to enable PHP 5.6 and 5.5 and installed PHP 5.6. I tested what I wanted to test and tried to switch back by disabling the repos and uninstall all php and then reinstall again. Now I have problems.
Here are the symptoms and what I've tried.
I get a message on a WordPress installation "Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
"
# php -v
PHP **7.2.14** (cli) (built: Jan 8 2019 14:05:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
<? phpinfo() ?> works but says php version **7.1.24**
I tried to check if php-mysql is still installed:
# yum list installed | grep php
php.x86_64 7.2.14-1.el7.remi @remi-php72
php-cli.x86_64 7.2.14-1.el7.remi @remi-php72
php-common.x86_64 7.2.14-1.el7.remi @remi-php72
php-gd.x86_64 7.2.14-1.el7.remi @remi-php72
php-json.x86_64 7.2.14-1.el7.remi @remi-php72
php-mysqlnd.x86_64 7.2.14-1.el7.remi @remi-php72
php-pdo.x86_64 7.2.14-1.el7.remi @remi-php72
php-pecl-mcrypt.x86_64 1.0.1-6.el7.remi.7.2 @remi-php72
# yum install php-mysql
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.layeronline.com
* epel: mirror.uic.edu
* extras: centos.mirror.globo.tech
* nux-dextop: mirror.li.nux.ro
* remi: repo1.ash.innoscale.net
* remi-php72: repo1.ash.innoscale.net
* remi-safe: repo1.ash.innoscale.net
* updates: centos.mirror.ca.planethoster.net
* webtatic: us-east.repo.webtatic.com
Package php-mysql-5.4.45-16.el7.remi.x86_64 is obsoleted by php-mysqlnd-7.2.14-1.el7.remi.x86_64 which is already installed
Is there any easy resolution to this mess, or should I just fresh install the whole development machine.
First remove everything regarding old php version (will take some time...)
sudo yum remove --setopt=clean_requirements_on_remove=1 php php-pear php-mysql php-cli php-common mod-php
then, install newer version (will take even more time)
sudo yum install mod_php70u php70u-cli php70u-mysqlnd
dont forget to do restart and check sudo apachectl restart systemctl status httpd
If you're running fpm with NGinX then use following uninstall (this will keep the config's just o remove packages / dependencies)
sudo yum remove --setopt=clean_requirements_on_remove=1 php-fpm php-cli php-common php7-fpm php7-cli php7-common
and install
sudo yum install php7-fpm-nginx php7-cli php7-mysqlnd
(use [72] instead of [7] if you need to)
save, exit and restart
sudo systemctl restart php-fpm
sudo systemctl restart nginx #(or whatever you use)
please consider stepping down to version 7.1, as that might be a little less pain connecting modules than latest version, especially on always problematic centOS
(thanks @fyrye for options on remove)