phpapcopcode-cache

apc.filters by path?


How would I use the apc.filters parameter in APC opcode caching to not cache certain paths? For example, I want caching to be active for anything under the path:

"/var/www/vhosts"

and exclude paths like

"/usr/share/psa-horde/"

I tried using

apc.cache_by_default = 0
apc.filters = "+/var/www/vhosts"

and

apc.cache_by_default = 1
apc.filters = "-/usr/share/psa-horde/"

But neither worked as I expected.

http://www.php.net/manual/en/apc.configuration.php#ini.apc.filters

Should the filter be something more like "+/var/www/vhosts/*" (note the wildcard)? I'm afraid this isn't possible because of the way filters works:

Note that the filename used for matching is the one passed to include/require, not the absolute path.

Any ideas or sample configurations?


Solution

  • The filter should be a comma separated list of POSIX extended regular expressions. I believe what you have in the second attempt only matches the exact path /usr/share/psa-horde/, and not /usr/share/psa-horde/something or /usr/share/psa-horde/anotherfile.php

    The following should match anything in the sub folder

    apc.filters = "-/usr/share/psa-horde/.*"