APC

From Server Knowledge Base
Jump to navigationJump to search

When doing php -v if you get:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/apc.so' - /usr/lib/php5/20090626/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0

Take a full server backup if possible and do the following via SSH:

vim /etc/apt/sources.list

Add in the following:

deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all

deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all

Then run:

apt-cache search libpcre3-dev
apt-get install libpcre3-dev

pecl install apc
#or
pecl channel-update pecl.php.net

Say the default to following to the prompts:

First prompt advice
Second prompt advice

Enable internal debugging in APC [no] : no
Enable per request file info about files used from the APC cache [no] : no #but yes can be useful in this case
Enable spin locks (EXPERIMENTAL) [no] : no
Enable memory protection (EXPERIMENTAL) [no] : no
Enable pthread mutexes (default) [yes] : yes
Enable pthread read/write locks (EXPERIMENTAL) [no] : no
pear config-set php_ini /etc/php5/apache2/php.ini
pecl config-set php_ini /etc/php5/apache2/php.ini

And now restart Apache for the changes to take effect:

apache2ctl graceful

Install Guide

If you want to uninstall it use:

pecl uninstall apc-3.1.9

xcache vs APC

APC vs eAccelerator vs Xcache
Xcache or APC 1
Xcache or APC 2