Merge pull request #439 from codeguy/feature/osx-install-improve

Revised Mac OSX Install instructions.
This commit is contained in:
Phil Sturgeon
2014-09-23 16:50:54 -05:00

View File

@@ -5,21 +5,40 @@ anchor: mac_setup
## Mac Setup {#mac_setup_title}
OS X comes prepackaged with PHP but it is normally a little behind the latest stable. Lion comes with PHP 5.3.6,
Mountain Lion has 5.3.10, and Mavericks has 5.4.17.
OS X comes prepackaged with PHP but it is normally a little behind the latest stable. Mountain Lion has
5.3.10, Mavericks has 5.4.17 and Yosemite has 5.5.9, but with PHP 5.6 out that is often not good enough.
To update PHP on OS X you can get it installed through a number of Mac [package managers][mac-package-managers], with
[php-osx by Liip][php-osx-downloads] being recommended.
There are multiple ways to install PHP on OS X.
You can also [compile it yourself][mac-compile]; if you do, be sure to have installed either Xcode or
Apple's substitute ["Command Line Tools for Xcode"][apple-developer], downloadable from Apple's Mac Developer Center.
### Install PHP via Homebrew
For a complete "all-in-one" package that includes PHP, Apache web server and MySQL database, all with a nice graphical interface, try [MAMP][mamp-downloads] or [XAMPP][xampp].
[Homebrew](http://brew.sh/) is a powerful package manager for OS X, which can help you install PHP and
various extensions easily. [Homebrew PHP] is a repository that contains PHP-related "forulae" for Homebrew,
and will let you install PHP.
[mac-package-managers]: http://www.php.net/manual/en/install.macosx.packages.php
At that point, you can install `php53`, `php54`, `php55` or `php56` using the `brew install` command, and switch between then by modifying your `PATH` variable.
### Install PHP via phpbrew
[phpbrew] is a tool for installing and managing multiple PHP versions. This can be really useful if two
different applications/projects require different versions of PHP, and you are not using virtual machines.
### Compile from Source
Another option that gives you control over the version of PHP you install, is to [compile it yourself][mac-compile].
In that case be sure to have installed either Xcode or Apple's substitute ["Command Line Tools for XCode"]
downloadable from Apple's Mac Developer Center.
### All-in-One Installers
The solutions listed above mainly handle PHP itself, and do not supply things like Apache, Nginx or a SQL server. "All-in-one" solutions such as [MAMP][mamp-downloads] and [XAMPP][xampp] will install these other bits of software for you and tie them all together, but ease of setup comes with a trade-off of flexibility.
[Homebrew]: http://brew.sh/
[Homebrew PHP]: https://github.com/Homebrew/homebrew-php#installation
[mac-compile]: http://www.php.net/manual/en/install.macosx.compile.php
[xcode-gcc-substitution]: https://github.com/kennethreitz/osx-gcc-installer
[apple-developer]: https://developer.apple.com/downloads
["Command Line Tools for XCode"]: https://developer.apple.com/downloads
[mamp-downloads]: http://www.mamp.info/en/downloads/
[php-osx-downloads]: http://php-osx.liip.ch/
[phpbrew]: https://github.com/phpbrew/phpbrew
[xampp]: http://www.apachefriends.org/en/xampp.html