Linux setup steps/Install APC as the PHP opcode cache
From Nick Jenkins
Installing APC as the opcode cache:
Benchmark before installing, on some PHP page on your site:
ab -kc 10 -t 30 http://yourhostname.com/some_php_page.php
Install required dependencies:
aptitude install apache2-dev aptitude install build-essential
Install APC (choose "yes" when prompted) :
pecl install apc
Then:
nano /etc/php5/apache2/php.ini
... and add these 3 lines to the end:
; APC opcode cache: extension=apc.so apc.mmap_file_mask=/tmp/apc.XXXXXX
Then reload apache:
/etc/init.d/apache2 restart
Check that there are no errors in the error log:
tail -20 /var/log/apache2/error.log
Benchmark after installing:
ab -kc 10 -t 30 http://yourhostname.com/some_php_page.php
- For me this showed an increase from 895 completed requests to 3728 completed requests on a test box.
- For me this showed an increase from 2889 completed requests to 12023 completed requests on a production box.
That's around a 4.1 times speed increase on two systems - not bad.
