I am trying to install PHP on my MAC machine using Homebrew.
I am using the following command:
brew install php
However, I am getting the following errors:
Error: No available formula with the name "php"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
Update (March 2018)
In February 2018, the php72
formula (the current version of PHP) has been moved into the core Homebrew tap and renamed as php
.
Installing PHP using Homebrew is now as easy as:
$ brew install php
The homebrew/php
tap has been deprecated and will be archived on March 31, 2018.
The plan is to also migrate the other currently supported versions of PHP to the core tap, using the new @
convention for versions (PHP 7.1 will be php@7.1
). After homebrew/php
is archived, the formulas it contains won't be available any more.
The original answer
The PHP ecosystem lives in the homebrew/php
tap. You can find there six versions of the interpreter (from 5.3
to 7.1
), extensions for them and some PHP-related tools.
In order to install PHP you have to install the homebrew/php
tap first (this is needed only once):
$ brew tap homebrew/php
$ brew install php70
Or you can do both operations in a single step by running:
$ brew install homebrew/php/php70
You could discover all these by searching php
first:
$ brew search php