← Thomas Lackemann

Installing Phalcon on Mac OS X Using MAMP

Posted on Feb 13, 2014 in

If you haven’t heard about Phalcon yet, it’s amazing. I chose Phalcon because I recently started a project that had to be spun up quickly with little learning curve and low overhead. Phalcon was the PHP framework I’ve been waiting for.

Preparation

If you view Phalcon’s Installation Instructions, there’s not much to follow if you’re a Mac user. At least not if you’re like me and have a MAMP installation running and didn’t feel like configuring apache and all that fun stuff natively (that’s what staging and production are for, am I right?) Surprisingly enough, getting Phalcon to install was pretty simple and straightforward. Here’s the process:

MAMP

  • Make sure you install MAMP and verify it works
  • Install XCode and that command line tools have been installed (Xcode > Preferences > Downloads)
  • Check what PHP version you’re using in MAMP (for me it was 5.4.10)
  • Download your source build from php.net (it’s extremely important you download the version of PHP you’re running on MAMP, not the latest)

Installation

The fun part. We’re going to assume that you’ve downloaded the source for PHP into ~/Downloads. Replace “X” with your version of PHP

# cd ~/Downloads
# mkdir /Applications/MAMP/bin/php/php-5.4.X/include
# tar zxvf php-5.4.X.tar.gz .
# mv php-5.4.X /Applications/MAMP/bin/php/php-5.4.X/include/php
# cd /Applications/MAMP/bin/php/php-5.4.X/include/php
# sudo ./install

This should leave you with a complete install of PHP 5.4.X (where X is your version number)

Next we want to install Phalcon

# cd ~/Downloads
# git clone --depth=1 git://github.com/phalcon/cphalcon.git
# cd cphalcon/build
# sudo ./install

Judging how finicky some Macs are you may have to install a few dependencies but if you’re successful, you should be greeted with a nice message along the lines of

Build complete.  
Don't forget to run 'make test'.

Installing shared extensions:     /Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/

Thanks for compiling Phalcon!

Success! Now add the extension to your php.ini file

# echo "extension=phalcon.so" >> /Applications/MAMP/bin/php/php5.4.4/conf/php.ini

That’s it! Don’t forget to restart MAMP. For more information on how to get started with Phalcon, refer to the Phalcon Getting Started Guide

Cheers!

About

Tom is the CEO (Customer Experience Overlord) of Unicorn Heart Club where he leads development for Astral TableTop. He's a homebrewer, hiker, and has an about page.

Read More

← Building an Entity-Attribute-Value System: Part II - Creating the Database

Comments