Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Switching to PHP 5.4 on OS X

DZone's Guide to

Switching to PHP 5.4 on OS X

· Web Dev Zone
Free Resource

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

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:

   
  1. brew tap homebrew/dupes
  2. brew tap josegonzalez/homebrew-php
  3. brew install php54 --with-mysql
  4. brew install php54-memcached
  5. brew install php54-xdebug

After that, open /etc/apache2/httpd.conf, and look for this line:

   
  1. LoadModule php5_module libexec/apache2/libphp5.so

Comment that out (with #) and add the following line:

   
  1. LoadModule php5_module /usr/local/Cellar/php54/5.4.9/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

 

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:

Published at DZone with permission of Evert Pot, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}