PHP APC on/off at Virtual Host level

Hello, I have several sites on one linode running nginx, mysql, php-fmp, apc. This linode if for some personal sites and sites under development. I have apc installed and working, but it is working for every site. I need to have it work on selective sites so my sites in development are not cached.

I've searched around but can't find any answers on how to make this change.

Each site/domain is run as a different user so I have a pool for each site.

Any insight would be appreciated. Any more info, please let me know. Thanks

4 Replies


apc.cache_by_default = off

in your main php.ini (or /etc/php.d/apc.ini if you use that) and

php_flag[apc.cache_by_default] = on

in the conf files for the pools you want to use it with.

Heres what I have:

Main php.ini: /etc/php5/fpm/php.ini, should have

"apc.cachebydefault = off"

Each site has:

/etc/php5/fpm/pool.d/mydomain.conf, and I should add

"phpflag[apc.cacheby_default] = on" in each I want to use APC.

Anything need to be done with /etc/php5/mods-available/apc.ini

Main php.ini: /etc/php5/fpm/php.ini, tried

"apc.cachebydefault = off"

After adding this and restarting php, the apc.php page still shows apc.cachebydefault = 1.


Tried also puttinv apc.cachebydefault = 1 in /etc/php5/mods-available/apc.ini, restarted and same thing, apc.php and info.php still says it is on by default.

Quick status update. Info on apc.php in site with it enabled shows apc.cachebydefault = 1 and on one with it turned off says apc.cachebydefault = 0, so it appears to be working now. Thanks for the help.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct