Uninstall default PHP on El Capitan
Solution 1:
In my opinion, the right way is to set your path to prefer your installation of PHP.
- Apple restricts PHP so you can't delete it without bypassing the system integrity protection
- Apple will update those files any time it pleases, so you're always needing to re-do whatever steps you take to modify the system
- If you make a virtual environment like docker or just using correct paths to your installation, those are portable and don't need any sort of extra work.
If you really need to delete those files, you would boot to recovery HD and disable SIP. Then delete all files and associated libraries (with the potential to break Apple tools if you delete something the system actually runs at some point) and then re-enable SIP as desired. I would make a good backup before changing SIP just in case you wish to recover the system after deleting things.