Monday, September 23, 2013

Installing Alternative PHP Cache (APC) on OSX.

APC is an opcode cache for optimizing PHP performance. Here is the steps to install it on Mac.

1. Create a src directory [Optional].
$ cd /usr/local/
$ mkdir src
$ cd src
2. Download PCRE, the APC requires PCRE libraries and header files.
$ curl -O ftp://ftp.csx.cam.ac.uk//pub/software/programming/pcre/pcre-8.31.tar.gz
3. Unzip the downloaded file.
$ tar -xvzf pcre-8.31.tar.gz
4.Install PCRE.
$ cd pcre-8.31
$ ./configure
$ make
$ sudo make install
5. Install APC.
$ sudo pecl install apc
6. Put the following line into the end of php.ini file.
$ extension=apc.so
7. Make sure that you have completely install APC.
$ php -m | grep apc  #should return "apc"