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 asphp
.Installing PHP using Homebrew is now as easy as:
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 bephp@7.1
). Afterhomebrew/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 (from5.3
to7.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):Or you can do both operations in a single step by running:
You could discover all these by searching
php
first: