This site runs on Mac OS X 10.6, a capable webserving platform “out-of-the-box” which includes:
Unfortunately, the stock PHP is pretty barebones and can trail behind the newest releases. Specifically, the open-source CMS/Weblog/ImageGallery stuff I use requires some common PHP extensions not included in the stock install, and the site is unbearably slow without some kind of caching PHP-accelerator.
This post details my setup procedure, mostly as a reminder for myself.
The good news is that since the first releases of Mac OS X, a host of options has been made available:
- Installing a third party Mac OS X PHP package (traditionally by Marc Liyanage, now superseded by http://php-osx.liip.ch/)
- Installing a full third-party MAMP stack
- installing the required add-ons manually
First off, I would like to dismiss MAMP as an inelegant solution, which duplicates much of the build-in functions leading to all kinds of interesting mix-ups for the less technically inclined. It is the webserver equivalent of taking a sledgehammer to drive a nail: not only overkill, it can be actually damaging to your system 😉
Historically, I have used the PHP compiled by Marc, which has been excellent, with the internal Apache and MySQL. By manually installing either eAccelerator (before 2009 or so) or APC the speed was pretty good too, even on the wimpy iMac G3 this site used to run on.
Unfortunately, current releases, as produced by the guys over at Liip, do not work on my 32-bit Core Duo based server. This has pushed me to consider manually adding the required extensions and APC to the “stock” Apple PHP 5.3.4.
Going “Stock” has the benefit of automatically receiving updates along with the OS X updates, and I definetely have not missed manually updating MySQL or Apache. A potential problem is that some extensions might require a recompile should Apple decide to move to a new verson of PHP.
And then now, on to the actual reason I started this post; the steps required to install these PHP extensions, as a reminder for myself mostly. A working install of the Mac OS X Developer tools is presumed.
- sudo pecl install APC
- when asked to enable spinlocks, choose “yes” instead of the default “no”
- modify /etc/php.ini to include the APC extension:
This should enable APC and leave you with a working setup!
If you must use Mcrypt, this requires compiling from the PHP source code. This is much more work than a simple extension install through PECL….
To add mcrypt, these instructions work fine, with the following caveats:
- PHP should now (10.6.8) be version 5.3.4 ( available here: us.php.net/get/php-5.3.4.tar.bz2/from/a/mirror)
- A space in the SRC path can make the installer fail with cryptic error messages
Check phpinfo() to see if both mcrypt and APC are now functioning, and all should be well!
Now all I need is a major round of updating the actual PHP apps
- Geeklog to 1.8
- Gallery to 3
- integration plugin for GL 1.8 and Gallery 3
- WordPress 3.2 update
- blogs integration in 1 multisite wordpress
- option: Geeklog migration to a WordPress multisite setup, a Gallery 3 plugin for WordPress is available.