0

I'm finding myself in an awkward situation. I need to install PHP and Nginx for development but I do not want to mess up my Mac with multiple installations. I have found that PHP and PHP-fpm are already installed. I would like to uninstall but I have no clue on how to do it as I don't know through what means it has been installed (Brew or Ports).

I have searched the php binary and it is in /usr/bin/

PHP 5.5.30 (cli) (built: Oct 23 2015 17:21:45) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

Mac OS X El Capitan 10.11.3
  • Anything in /usr/bin is installed via Apple and should not be touched. However if you have both macports and homebrew and you asking this sort of question you will have problems I would reinstall OS X from scratch and choose only one package manager – Mark Jan 22 '16 at 12:43
  • php is included with OS X. Please can you add the output of /usr/bin/php --version and the version of OS X you are using. – Graham Miln Jan 22 '16 at 12:43
1

PHP 5.5.30 (cli) (built: Oct 23 2015 17:21:45) is the version of php shipped by Apple with OS X 10.11.3.

You can use brew to install a current version of php – without affecting the built-in version.

brew installs its binaries in /usr/local/Cellar. A modification to your PATH ensures the brew installed version is found before the OS X provided version.

MacPorts uses a similar approach. Which package provider you use is a matter of personal preference.

Install php via brew

To install php via brew, first install brew using the instructions on their web site:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install php:

brew install php

Remove php via brew

When you need to remove php installed via brew – thus reverting php back to the version shipped with OS X – run:

brew uninstall php

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .