Install PHP APC on Snow Leopard
Download the latest stable release of APC. (At time of writing, this is APC-3.0.19)
Uncompress the files and use terminal to go into the directory with the source files. Run the following command.
cd APC-3.0.19/APC-3.0.19/ ./configure
This should work with no problems. Next run:
make
Ah - here's some trouble. You should run into an error like this:
/APC-3.0.19/APC-3.0.19/php_apc.c:959: error: duplicate 'static' make: *** [php_apc.lo] Error 1
Not a problem. Load up the file php_apc.c in a text editor. Find line 959 and delete the word "static". Go back into terminal and run make again.
make
APC should now compile without any problems.
sudo make install
We should now have a shared extension in /usr/lib/php/extensions/.
Now all that is left to do is tell your php.ini file that you'd like apc loaded. Add the following lines to your /etc/php.ini file.
extension = apc.so apc.enabled=1 apc.shm_size=30
Save and restart apache.
sudo apachectl restart
Now load up a phpinfo() page. You should now see the following.
-------------------- apc -------------------- APC Support enabled Version 3.0.19 MMAP Support Enabled MMAP File Mask no value Locking type File Locks Revision $Revision: 3.154.2.5 $ Build Date Mar 26 2010 15:58:42 --------------------
Congrats! You just installed APC on Snow Leopard. Enjoy all that caching goodness.
Comments (3)
Thanks for this helpful tutorial.
However, with more recent stable versions of APC (such as 3.1.9), you won't get the same error while running make command. Maybe that would be great to update this tuto.
Thanks again, still.
Looks like we need to 'phpize' before we can './configure'
Thank you so much. I had googled around looking for results that didn't suggest installing the latest beta (where it has since been fixed) and yours was the only one.
I am very grateful.