Getting APC to work on OSX 10.6

If APC won’t compile manually or with PECL, complains of “pcre error: blah blah” or similar, it means there is a problem with the PCRE libs on your Mac. Either pcre.h is missing or not in your path or some other conflict.

I found this a while back and it still seems to work:

“While not a solution, by soft-linking to the alternate pcre.h location (e.g., “ln -s /opt/local/include/pcre.h /usr/include/php/ext/pcre/”), I was able to get it to compile.”

The “opt” location is the MacPorts version of PCRE. I also was able to get it to compile simply by copying the MacPorts version of the pcre header file (pcre.h) to /usr/include/php/ext/pcre/pcre.h (as there wasn’t one there) and ran the PECL install with no problems. On a prior install I linked to the macports pcre directory, see below, to compile from source.

After copying or soft-linking the pcre.h file:
Try PECL first:

pecl install APC

If compiling APC from source:

./configure --enable-apc --enable-mmap --with-pcre-regex=/opt/local/include \
--with-pcre-dir=/opt/local/include

Leave a Reply