Acquia Drupal Stack - Adding PHP Extensions
Need technical support for the stack installer? See the Acquia Drupal Stack - FAQ for details.
Adding PHP extensions with phpize (Mac OS X only)
The Acquia Drupal stack includes includes phpize to allow users to build php extensions that will match the version of PHP it runs.
Required: Apple Xcode Tools
This process relies on utilities contained in Apple's Xcode tools. These come on every OS X installation disk and are also available at http://developer.apple.com/tools/xcode/. Be sure you have installed "Developer Tools Essentials" and "UNIX Development Support" (also called "UNIX Dev Support" on some versions) on your system before continuing with these instructions.
Install PHP extension
You can build and add any compatible extension from the PECL repository. The following example shows how to add support for LZF compression using the corresponding PECL extension.
Note: Dependencies - Some extensions have dependencies on other extensions and libraries. Check the project page and instructions of the extension you wish to install and include all dependencies as required.
-
Download PHP extension tarball - Find the extension you need at http://pecl.php.net/ and navigate to its project page. For our example, that is http://pecl.php.net/package/lzf. Copy the link to the version of the archive you require and download it to your computer:
curl -O http://pecl.php.net/get/LZF-1.5.2.tgz -
Untar PHP extension archive using a command like this:
tar -zxvf LZF-1.5.2.tgz -
Build PHP extension - The following command example assumes you have installed the Acquia Drupal stack in its standard location (/Applications/acquia-drupal/). If you have installed it somewhere else, modify the following commands accordingly.
To make it work under both OS 10.5 and 10.6, the DAMP stack is compiled in OS 10.5 compatibility mode. You must therefore build your PHP extensions to be compatible with OS 10.5. This string sets this compatibility in the commands below: "CFLAGS='-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5'".
On the command line, navigate inside the extension directory, then run the following commands, one at a time:
/Applications/acquia-drupal/php/bin/phpizeCFLAGS='-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5' \
./configure --with-php-config=/Applications/acquia-drupal/php/bin/php-configmake -
Add PHP extension to DAMP stack - The following command example assumes you have installed the Acquia Drupal stack in its standard location (/Applications/acquia-drupal/). If you have installed it somewhere else, modify the following commands accordingly.
The 'make' command will have made a 'modules' directory within the extension source directory. Copy the module to the DAMP stack's extensions directory with a command like this:
cp modules/*.so /Applications/acquia-drupal/php/ext -
Register PHP extension - The following command example assumes you have installed the Acquia Drupal stack in its standard location (/Applications/acquia-drupal/). If you have installed it somewhere else, modify the following commands accordingly.
The 'modules' directory you copied in the previous step contains a .so file. Add a line like the following (using the appropriate name) to the "Dynamic Extensions" section of the DAMP stack's php.ini file, which can be found at: /Applications/acquia-drupal/php/bin/php.ini
extension=lzf.so -
Restart Apache - using the main Stop/Start button on the Acquia DAMP stack control panel.

Joshua Koenig
Worked like a charm to
Worked like a charm to install APC locally. Thanks, Acquia!
The Acquia Drupal stack is
The Acquia Drupal stack is 32bit therefore all PHP add-on libraries must be compiled as 32 bit (i386). If you are using OSX 10.6 (Snow Leapord) which is 64 bit, you need to tell the compiler to build a 32 bit library which can be done by executing the below command before you do any of the above steps.
export MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386" CXXFLAGS="-arch i386" LDFLAGS="-arch i386"After you are done compiling the library you can execute `files modules/*.so` which will confirm that the file was compiled as i386 (32 bit)
Reference: Compile APC for XAMPP on Snow Leopard
http://blog.elinkmedia.net.au/2010/05/04/compile-apc-for-xampp-on-snow-l...
Jam, I have never had to compile any PHP related code before, which is ironic since I usually use Ubuntu, feel free the chime in and correct any mistakes. The above snippet was from trial-n-error cut-n-pasting without really knowing which compiler flags were 100% required.