Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Eric Barnes:
How to set up your Mac for local PHP Development
Aug 05, 2015 @ 10:48:14

Eric Barnes has posted a guide to helping you set up (as he sees it) a good PHP development environment on your Mac that includes Homebrew for package management, Composer, Vagrant and the Laravel Homestead VM for project hosting.

This past weekend I decided it was finally time to wipe my Macbook’s hard drive and start fresh. I have used it daily for several years now and still had artifacts from when I used Mamp. Since then Vagrant has turned to my local server of choice and one of the reasons is how clean you can keep your machine by utilizing it.

After finishing the new Mac OS X install it felt like a new beginning. So clean, so minimal. [...] This go around I wanted to keep it as minimal as possible and only install things I know I need and use. This tutorial covers how I set up my Mac for local PHP Development.

His list of software includes the previously mentioned four as well as the ZSH shell replacing the default bash and, obviously, PHP itself installed via Homebrew.

tagged: osx mac local development homestead composer zsh vagrant homebrew

Link: http://ericlbarnes.com/set-mac-local-php-development/

Rob Allen:
Setting up PHP & MySQL on OS X Yosemite
Oct 20, 2014 @ 09:43:36

Rob Allen has posted a quick guide to help you get PHP and MySQL set up on Yosemite, the latest version of Apple's OSX operating system (just released last week).

t's that time again; Apple has shipped a new version of OS X, 10.10 Yosemite. Apple ships PHP 5.5.14 with Yosemite and this is how to set it up from a clean install. However, if you don't want to use the built-in PHP or want to use version 5.6, then these are some alternatives [including the Liip binary package, Homebrew or Zend Server 7.x).

He opts for the Homebrew method, installing it first then getting into the PHP and MySQL packages. This is all done from the command-line, so you'll need to be comfortable there. He includes the commands needed to install PHP, MySQL and Apache along with all configuration changes to make them work together. He also shows how to install Xdebug, PEAR, Composer and the Mcrypt & Intl extensions if needed.

tagged: setup osx yosemite mysql homebrew package install apache intl mcrypt

Link: http://akrabat.com/php/setting-up-php-mysql-on-os-x-yosemite/

Xdebug - Professional PHP Debugging
Aug 29, 2013 @ 09:56:01

On NetTuts.com there's a new article introducing Xdebug, a powerful tool that can help you with debugging your PHP applications. It works by investigating what's happening "on the inside" and reporting it back to your debugger.

Well, technically, Xdebug is an extension for PHP to make your life easier while debugging your code. [...] But just imagine for a moment, as your applications evolve, you might get into the habit of sprinkling your code all over with little echos, var_dumps and custom debuggers. [...] The next question is: how do you debug in production? [...] Now lastly, have you ever wished to be able to step through your code, line by line, watch expressions, and even step into a function call to see why it’s producing the wrong return value? Well, you should definitely dig into the world of professional debugging with Xdebug, as it can solve all of the problems above.

They walk you through the setup of a complete (MAMP-based) environment on an OSX installation. You'll also need Xcode and the command line tools to be able to compile Xdebug. They recommend installing Homebrew to make installing the needed tools easier. They use Homebrew to install the PHP 5.4 version of Xdebug which then compiles and outputs a shared module you can put in your PHP extensions directory.

On the other side of things, the article also helps you set up your IDE, in this case PHPStorm but it would work for lots of others - to accept the debug messages from the server. He includes a sample script with some calls to the Xdebug-enabled debugging functions and what kind of responses (with screenshots) you should see in your IDE.

tagged: xdebug debugging extension homebrew mamp osx install tutorial

Link: http://net.tutsplus.com/tutorials/tools-and-tips/xdebug-professional-php-debugging/

Alex Simonenko's Blog:
Installing PHP 5.3.6 on OS X Lion
Jul 20, 2011 @ 11:27:30

Alex Simonenko has a new post to his blog talking about what he had to do to get PHP 5.3.6 working on his OS X Lion installation since a previous method no longer worked. in his new post he shares his solution - using Homebrew. (Note: original post is in Russian)

After installing OS X Lion (10.7) was faced with an unpleasant problem, install PHP + MySQL bundle as I did before does not work. And as it turned out, the problem is in MySQL, source code is not yet ready for the new OS from Apple. After some thought and reading similar problems on the Internet, I found [a solution to the problem].

He includes the commands you'll need to get Homebrew installed and configured to install a fresh download of the archive (dmg) after a few setup changes. He uses Homebrew to install a few dependencies the installation will need and his example configure options for the build. Then the install is just a "make" and "make install" away.

tagged: install homebrew tutorial osx lion version


Rob Allen's Blog:
MongoDB on OS X with the stock PHP installation
Jun 07, 2010 @ 11:07:08

After a bit of trial and error Rob Allen was able to get MongoDB up and running on his local OS X installation of PHP. He's blogged about how he did it with the help of the homebrew tool.

MongoDB was mentioned a few times at tek and I said that I wanted to have a look at. Travis' article, MongoDB: A first look, came out a few days ago and piqued my interest further. Then Matthew sent me some source code that requires it. The stage was set for getting MongoDB working on my Mac.

Using the homebrew utility he was able to easily install MongoDB itself and setting up PHP support for it was as simple as calling the "pecl" command line to grab and build the shared object. Drop it into your php.ini file and you're all set to go.

tagged: mongodb osx install homebrew tutorial


Sean Coates' Blog:
PHP 5.3 on Snow Leopard
May 26, 2010 @ 13:03:00

Due to the popularity (and age) of his previous post about compiling PHP 5.3 on Snow Leopard (OS X), Sean Coates has written an updated post showing some of the changes to the process that the updated OS version has brought with it.

I've been meaning to post instructions on how to compile PHP for Snow Leopard since last summer when I picked up the DVD, but hadn't found the time or opportunity to build PHP from a completely fresh start, until a few weeks ago. This time, I took notes on how to reliably compile PHP and Apache from scratch on this system.

He's made a six step process that includes installing Xcode, Homebrew, your own version of iconv, support for whatever dependencies you might still need and, of course, Apache/PHP.

tagged: compile php5 snowloepard osx homebrew xcode