Today i was working with one of my project where I faced issues with php dependent packages which were conflicting with older preinstalled older versions packages. To get ride of this i followed below steps:
Note: This will broke the running website so please do not try on PRODUCTION systems, this artical is just for knowledge sharing and not recommended to be used for systems with PRODUCTION status, I use this for my own knowledge
—–> ERRORS were like this:
Error: Package: php56-php-pecl-graphdat-1.0.4-1.el7.remi.x86_64 (remi-safe)
Requires: libmsgpack.so.3()(64bit)
Error: php71-php-pecl-libsodium2 conflicts with php71-php-pecl-libsodium-1.0.6-3.el7.remi.x86_64
Error: php71-php-pecl-imagick conflicts with php71-php-pecl-gmagick-2.0.4-0.3.RC1.el7.remi.x86_64
Error: php-pecl-gmagick conflicts with php70w-pecl-imagick-3.4.3-1.w7.x86_64
Error: php56-php-phalcon2 conflicts with php56-php-phalcon-1.3.4-1.el7.remi.x86_64
Error: php56-php-pecl-imagick conflicts with php56-php-pecl-gmagick-1.1.7-0.6.RC3.el7.remi.x86_64
Error: Package: php72-php-pecl-varnish-1.2.2-3.el7.remi.x86_64 (remi-safe)
Requires: libvarnishapi.so.1(LIBVARNISHAPI_1.2)(64bit)
Error: php54-php-pecl-json-post conflicts with php54-php-pecl-http1-1.7.6-5.el7.remi.x86_64
Error: php-mysql conflicts with php71w-mysqlnd-7.1.8-2.w7.x86_64
Error: php56-php-pecl-gmagick conflicts with php56-php-magickwand-1.0.9.2-12.el7.remi.x86_64
FIRST take the backup of you existing repos, just to be on safer side:
[root@ip-172-31-24-184 yum.repos.d]# yum remove php*
Loaded plugins: fastestmirror, priorities, replace, s3iam
Resolving Dependencies
--> Running transaction check
---> Package php-common.x86_64 0:5.4.16-42.el7 will be erased
---> Package php-intl.x86_64 0:5.4.16-42.el7 will be erased
--> Finished Dependency Resolution
[root@techs-demo-server-01 u01]# cd /etc/yum.repos.d/
[root@techs-demo-server-01 yum.repos.d]# ls
base.repo mysql-community-source.repo remi.repo
centosplus.repo mysqlreset.text remi-safe.repo
epel.repo old-repo updates.repo
extras.repo remi-php54.repo webtatic-archive.repo
mysql57-community-release-el7-9.noarch.rpm remi-php70.repo webtatic.repo
mysql-community.repo remi-php71.repo webtatic-testing.repo
[root@techs-demo-server-01 yum.repos.d]# mv remi* old-repo/
[root@techs-demo-server-01 yum.repos.d]# ll
total 60
-rw-r--r-- 1 root root 172 Jun 14 19:58 base.repo
-rw-r--r-- 1 root root 192 Jan 17 2017 centosplus.repo
-rw-r--r-- 1 root root 237 Jan 17 2017 epel.repo
-rw-r--r-- 1 root root 180 Jan 17 2017 extras.repo
-rw-r--r-- 1 root root 9224 Sep 12 2016 mysql57-community-release-el7-9.noarch.rpm
-rw-r--r-- 1 root root 1627 Apr 5 10:37 mysql-community.repo
-rw-r--r-- 1 root root 1663 Apr 5 10:37 mysql-community-source.repo
-rwxr-xr-x 1 root root 64 Jun 14 20:47 mysqlreset.text
drwxr-xr-x 2 root root 4096 Sep 10 11:38 old-repo
-rw-r--r-- 1 root root 183 Jan 17 2017 updates.repo
-rw-r--r-- 1 root root 963 Oct 8 2014 webtatic-archive.repo
-rw-r--r-- 1 root root 865 Oct 8 2014 webtatic.repo
-rw-r--r-- 1 root root 963 Oct 8 2014 webtatic-testing.repo
[root@techs-demo-server-01 yum.repos.d]# mv mysql* old-repo/
[root@techs-demo-server-01 yum.repos.d]# ll
total 36
-rw-r--r-- 1 root root 172 Jun 14 19:58 base.repo
-rw-r--r-- 1 root root 192 Jan 17 2017 centosplus.repo
-rw-r--r-- 1 root root 237 Jan 17 2017 epel.repo
-rw-r--r-- 1 root root 180 Jan 17 2017 extras.repo
drwxr-xr-x 2 root root 4096 Sep 10 11:38 old-repo
-rw-r--r-- 1 root root 183 Jan 17 2017 updates.repo
-rw-r--r-- 1 root root 963 Oct 8 2014 webtatic-archive.repo
-rw-r--r-- 1 root root 865 Oct 8 2014 webtatic.repo
-rw-r--r-- 1 root root 963 Oct 8 2014 webtatic-testing.repo
[root@techs-demo-server-01 yum.repos.d]# mv webtatic* old-repo/
[root@techs-demo-server-01 yum.repos.d]# ls
base.repo centosplus.repo epel.repo extras.repo old-repo updates.repo
[root@techs-demo-server-01 yum.repos.d]# mv epel.repo old-repo/
[root@techs-demo-server-01 yum.repos.d]# ll
total 20
-rw-r--r-- 1 root root 172 Jun 14 19:58 base.repo
-rw-r--r-- 1 root root 192 Jan 17 2017 centosplus.repo
-rw-r--r-- 1 root root 180 Jan 17 2017 extras.repo
drwxr-xr-x 2 root root 4096 Sep 10 11:39 old-repo
-rw-r--r-- 1 root root 183 Jan 17 2017 updates.repo
[root@techs-demo-server-01 yum.repos.d]# yum list php
Loaded plugins: fastestmirror, priorities, replace, s3iam
Loading mirror speeds from cached hostfile
* base: mirror.pac-12.org
* extras: mirror.san.fastserv.com
* updates: mirrors.ocf.berkeley.edu
Available Packages
php.x86_64 5.4.16-42.el7 base
[root@techs-demo-server-01 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, priorities, replace, s3iam
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
Uninstall the existing php modules (make sure you stop your web site),now remove the installed PHP packages
[root@techs-demo-server-01 yum.repos.d]# yum remove php*
Loaded plugins: fastestmirror, priorities, replace, s3iam
Resolving Dependencies
--> Running transaction check
---> Package php-common.x86_64 0:5.4.16-42.el7 will be erased
---> Package php-intl.x86_64 0:5.4.16-42.el7 will be erased
--> Finished Dependency Resolution
setup new repo, I setup REMI repository:
[root@techs-demo-server-01 yum.repos.d]# wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
--2017-09-10 11:47:33-- http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Resolving rpms.remirepo.net (rpms.remirepo.net)... 195.154.241.117, 2001:bc8:33a1:100::1
Connecting to rpms.remirepo.net (rpms.remirepo.net)|195.154.241.117|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11380 (11K) [application/x-rpm]
Saving to: ‘remi-release-7.rpm’
100%[============================================================>] 11,380 --.-K/s in 0s
2017-09-10 11:47:34 (296 MB/s) - ‘remi-release-7.rpm’ saved [11380/11380]
[root@techs-demo-server-01 yum.repos.d]# ls
base.repo centosplus.repo extras.repo old-repo remi-release-7.rpm updates.repo
[root@techs-demo-server-01 yum.repos.d]# rpm -Uvh remi-release-7.rpm
warning: remi-release-7.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:remi-release-7.3-2.el7.remi ################################# [ 50%]
Cleaning up / removing...
2:remi-release-7.3-1.el7.remi ################################# [100%]
Now install YUM utilities:
[root@techs-demo-server-01 yum.repos.d]# yum -y install yum-utils
run yum update
[root@techs-demo-server-01 yum.repos.d]# yum update
enable the YUM repo, here I installed repo for php70:
[root@techs-demo-server-01 yum.repos.d]# yum-config-manager --enable remi-php70
Check the repo with in repo directory to verify:
[root@techs-demo-server-01 yum.repos.d]# ls
base.repo extras.repo remi-php54.repo remi-php71.repo remi-release-7.rpm remi-safe.repo
centosplus.repo old-repo remi-php70.repo remi-php72.repo remi.repo updates.repo
In our case the requirement is for php 7.1 so we removed the 7.0 and enabled 7.1
[root@techs-demo-server-01 yum.repos.d]# rm remi-php70.repo
[root@techs-demo-server-01 yum.repos.d]# vi base.repo
[root@techs-demo-server-01 yum.repos.d]# yum-config-manager --enable remi-php71
Verify the php list again:
[root@techs-demo-server-01 yum.repos.d]# yum list php
Loaded plugins: fastestmirror, priorities, replace, s3iam
remi-php71 | 2.9 kB 00:00:00
remi-php71/primary_db | 201 kB 00:00:00
Now check the availability of packages as required:
[root@techs-demo-server-01 yum.repos.d]# yum list php php-common php-int
Loaded plugins: fastestmirror, priorities, replace, s3iam
Loading mirror speeds from cached hostfile
* base: centos.sonn.com
* extras: centos.eecs.wsu.edu
* remi-php71: repo1.sea.innoscale.net
* remi-safe: repo1.sea.innoscale.net
* updates: repos.forethought.net
Available Packages
php.x86_64 7.1.9-1.el7.remi remi-php71
php-common.x86_64 7.1.9-1.el7.remi remi-php71
Once we verified that all required packages are in the list, we will install now:
[root@techs-demo-server-01 yum.repos.d]# yum install php php-common php-intl php-mysql
[root@techs-demo-server-01 yum.repos.d]# php -v
PHP 7.1.9 (cli) (built: Aug 30 2017 20:06:08) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
after this we noticed the errors with phpmyadmin:
For this we need php-mbstring package, check this and then install:
[root@techs-demo-server-01 yum.repos.d]# yum list php-mbstring
Loaded plugins: fastestmirror, priorities, replace, s3iam
Loading mirror speeds from cached hostfile
* base: centos.sonn.com
* extras: centos.eecs.wsu.edu
* remi-php71: repo1.sea.innoscale.net
[root@techs-demo-server-01 yum.repos.d]# yum install php-mbstring