Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Switching to PHP 5.4 on OS X
+0 Vote Up -0 Vote Down

I like using OS X's built-in packages where possible, but unfortunately Apple is way behind with their PHP package, having it locked on 5.3.15. In the past I've seen people use tools like Mamp, or Xampp to provide this for them, but frankly I'm not a big fan of these tools.

Homebrew provides a solution. Homebrew is OS X missing package manager, and it's an absolute great tool to work with. Getting started with it is a bit harder, as there's a few bigger dependencies you need, such as an up-to-date XCode installation. Once you've installed homebrew, it's a matter of running the following commands:

  • brew tap homebrew/dupes
  • brew tap josegonzalez/homebrew-php
  • brew install php54 --with-mysql
  • brew install php54-memcached
  • brew install php54-xdebug
  • After that, open /etc/apache2/httpd.conf, and look for this line:

  • LoadModule php5_module libexec/apache2/libphp5.so
  • Comment that out (with #) and add the following line:

  • LoadModule php5_module /usr/local/Cellar/php54/5.4.12/libexec/apache2/libphp5.so
  • After that, restart apache and things should just work. For more detailed instructions, take a look at the documentation for homebrew-php

    Edit: On one Mac I had to first run "brew unlink libiconv" for PHP compilation to complete.

    Votes:

    You must be logged in with a MySQL account to vote on Planet MySQL entries. More information on PlanetMySQL voting.

    Planet MySQL © 1995, 2013, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

    Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.