linux 卸载php,史上最详情

ps:网上方法还是挺多的,但是大多都是复制别人的,细节方面不到位。

首先执行

rpm -qa|grep php

会弹出

[root@localhost ~]# rpm -qa|grep php
php-common-5.4.16-45.el7.x86_64
php-pdo-5.4.16-45.el7.x86_64
php-gd-5.4.16-45.el7.x86_64
php-devel-5.4.16-45.el7.x86_64
php-fpm-5.4.16-45.el7.x86_64
php-process-5.4.16-45.el7.x86_64
php-pear-1.9.4-21.el7.noarch
php-bcmath-5.4.16-45.el7.x86_64
php-mbstring-5.4.16-45.el7.x86_64
php-xml-5.4.16-45.el7.x86_64
php-odbc-5.4.16-45.el7.x86_64
php-xmlrpc-5.4.16-45.el7.x86_64
php-cli-5.4.16-45.el7.x86_64
php-5.4.16-45.el7.x86_64
php-ldap-5.4.16-45.el7.x86_64

这个时候执行命令rpm -e [软件包] 例如:我要卸载上面的 php-common-5.4.16-45.el7.x86_64,就执行

rpm -e php-common-5.4.16-45.el7.x86_64

但是呢,每个包之间是互相依赖的,所以有卸载顺序,这个顺序是网上讲的不够详细的,坑爹呢,我这里对这个顺序讲一下

比如我要卸载 php-pdo-5.4.16-45.el7.x86_64,然后我执行了

rpm -e php-pdo-5.4.16-45.el7.x86_64

但是这个时候是失败的,因为它依赖的其他的包,但是没关系,因为系统会弹出这个,看下图

它很明确提示要先卸载 php-odbc-5.4.16-45.el7.x86_64

这个时候卸载 php-odbc-5.4.16-45.el7.x86_64就行了

rpm -e php-odbc-5.4.16-45.el7.x86_64

现在明白了吗,想卸载什么直接卸载就是,不要在意顺序,它会提示你的,然后你按它提示来就行了。

原文地址:https://www.cnblogs.com/leaf-cq/p/14831532.html