How to delete php on mac?

青灯夜游
Release: 2023-03-07 13:08:02
Original
3708 people have browsed it

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.

How to delete php on mac?

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 //开启
Copy after login

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 //重启
Copy after login

Open rootless

It is recommended to open rootless after deleting php

csrutil enable //开启rootless
reboot
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template