Installing PECL extensions for PHP is usually quite simple, you fire up terminal and type sudo pecl install apc, which should install the Alternative PHP Cache extension.
However, it seems that APC is not 100% compatible with OSX as neither the stable (3.0.19) nor beta (3.1.3p1) will compile under 10.6.
I should say that I am not an expert at compiling code so I can’t go into why this works, it’s just the steps I found across the internet collected into one location.
First, download APC-3.0.19.tgz and extract it .
If you haven’t already installed the XCode tools from your OSX installation disks, do that now.
In terminal cd to the directory containing the source code.
$ cd Downloads/APC-3.0.19/APC-3.0.19/
Here’s the tricky bit, you need to comment out line 959 of php_apc.c (says only static, otherwise it’ll throw an error when you compile.
$ phpize
$ MAMACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Developer/SDKs/MacOSX10.6.sdk/usr/bin/php-config
$ make
$ sudo make install
You’ll then need to add the line extension=apc.so to your php.ini file.


Comments
There are no responses to “Compiling PECL APC for OSX Snow Leopard” (Subscribe by RSS)
Comments are closed.