Home  >  Article  >  Backend Development  >  Example of php method to force uninstall under Linux

Example of php method to force uninstall under Linux

小云云
小云云Original
2018-03-06 10:59:502575browse

Originally, the Lamp environment had been installed on centOS6.6. Because the php5.3 version was relatively low, we used the remi source to upgrade to 5.5. Then the problem came: the php-xml used in the project was found under centOS. I can't find the yum installation package, and other extensions can't be found, so I have no choice but to roll back to the php version. However, there is no command to "downgrade" PHP, so you need to uninstall the original PHP and reinstall PHP.

To uninstall php, using the command yum remove php is not enough, because yum will not help you completely uninstall php. If you use php -v you can find that the version number of php still exists. .

The correct way to uninstall PHP is to delete the rpm installation package of PHP (in fact, yum installation still uses the rpm package fundamentally, but yum installation can solve the package dependency problem that occurs during rpm installation).

The command is as follows:

#rpm -qa|grep php lists all php related rpm packages

#rpm -e xxx xxx refers to the previous command line Just copy the package name of the rpm package. In this step, uninstall the installed PHP rpm package. Note that errors may occur due to possible dependencies, so you may need to adjust the order of the rpm packages to be written.

If you adjust the order of rpm packages and still cannot delete the remaining packages, you can solve the problem by force deletion:

#rpm -e xxx --nodeps where xxx still refers to the rpm package name

After forced deletion, you can reinstall php:

# yum -y install php can change the yum source and install other versions of php, because the source of centOS6.6 only gives Source of php5.3.

Related recommendations:

php interview question four - Linux part (advanced part) linux php linux uninstall php linux start ph

The above is the detailed content of Example of php method to force uninstall under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn