I’ll assume that you have installed apc already, if this is not the case this will probably be something as simple as running
pecl install apc
or downloading the archive from pecl and running:
phpize; ./configure; make; make install
The APC extension needs to be enabled either in php.ini or in one included file with a line like this:
there are many other parameters that apc can be fine tuned (see the official doc for more info), but without any other change, just with this line apc will be enabled on all the vhosts on the server.
Disabling some vhosts from using APC
- if we want to disable APC for a particular vhost we just have to add to the vhost config or to .htaccess:
php_flag apc.cache_by_default Off
Enabling APC only on some vhosts
- if we want to have APC disabled by default globally we will have in php.ini:
and we will enable APC for the particular vhost config or using .htaccess using:
extension=apc.so [apc] apc.cache_by_default=0 # disable by default ... other apc settings...
php_flag apc.cache_by_default On
Hopefully you found this post useful and this will give you a reason to use APC with more confidence knowing that you have the granularity to disable/enable it as needed in a shared environment.