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
現在明白了嗎,想卸載什么直接卸載就是,不要在意順序,它會提示你的,然后你按它提示來就行了。當然還會有一些頑固分子,比如他們互相依賴的,讓你誰也卸不掉,只要執行 rpm -e 程序包名 --nodeps
rpm -e php56-php-common-5.6.40-29.el8.remi.x86_64 --nodeps
