Home >Backend Development >PHP Problem >How to delete php on mac?
How to delete php on mac: 1. Temporarily close rootless; 2. Enter the corresponding PHP directory and execute commands such as "sudo rm -rf php-fpm.conf.defaultphp.ini php.ini.default" Just delete php.
Recommended: "PHP Video Tutorial"
rootless kernel protection
When deleting the php file, you will find that you do not have permission to delete it. The built-in php is protected by the system. Turn off rootless
Check the rootless status
csrutil status //查看rootless状态 enable //开启
Close rootless
Restart the computer and hold down Command R to enter the recovery partition. Then find the terminal in the utility bar and start running.
csrutil disable //关闭rootless reboot //重启
Open rootless
It is recommended to open rootless after deleting php
csrutil enable //开启rootless reboot
After upgrading to the new version of mac, it may The error is reported as follows: rm: php: Read-only file system
The solution is to close the system’s sip and then delete some files
Executesudo mount -uw /
and you can continue to uninstall~
Delete the built-in php
cd /private/etc/ && sudo rm -rf php-fpm.conf.defaultphp.ini php.ini.default cd /usr/bin/ && sudo rm -rf php php-config phpdoc phpize cd /usr/include && sudo rm -rf php //10.14之后没有此目录 cd /usr/lib && sudo rm -rf php cd /usr/sbin && sudo rm -rf php-fpm cd /usr/share && sudo rm -rf php cd /usr/share/man/man1 && sudo rm -rf php-config.1 php.1 phpize.1 cd /usr/share/man/man8 && sudo rm -rf php-fpm.8
The left is the directory, and the right is the delete command. Only php is deleted, and the php.so and other files referenced by apache are not deleted
ps: It is not recommended to delete the built-in php version. Because some The software may depend on the PHP environment. Although you can self-compile or use brew to install a new version of PHP, it is not recommended for novices. Remember to use TM to back up the system before operation so that you can restore the files after a mistake.
For more programming-related knowledge, please visit: Introduction to Programming! !
The above is the detailed content of How to delete php on mac?. For more information, please follow other related articles on the PHP Chinese website!