天天看點

centos 下安裝解除安裝php

1:rpm -qa|grep php  #列出所有的php相關的rpm包

centos 下安裝解除安裝php

 解除安裝php的指令,使用指令yum remove php是不夠的,因為yum并不會幫你把php完全解除安裝掉,如果你使用php -v可以發現php的版本号仍然存在

centos 下安裝解除安裝php
centos 下安裝解除安裝php

2:正确的解除安裝php的方法是:删除php的rpm安裝包(其實yum安裝在根本上還是使用的rpm包,隻是yum安裝能解決rpm安裝時發生的包依賴問題)。

      指令如下:

      rpm -qa|grep php  #列出所有的php相關的rpm包

      rpm -e xxx   #xxx指的是上一個指令列出的rpm包的包名,複制即可。這一步是安裝的rpm包,注意因為可能存在依賴關系會發生報錯,是以可能需要調整下要寫在的rpm包的順序。

      如果調整了rpm包的順序,還是無法删除剩餘的包,可以通過強制删除來解決:

      rpm -e xxx --nodeps    #其中xxx指的還是rpm包

      強制删除後,就可以重新安裝php了

centos 下安裝解除安裝php
centos 下安裝解除安裝php

3: 安裝php 

 yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common   

centos 下安裝解除安裝php

  ps:有興趣的可以關注下我的公衆号和小程式,謝謝啦~~

centos 下安裝解除安裝php
centos 下安裝解除安裝php