Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to enable/disable APC on a per virtual host basis? I'd rather not use precious apc shared memory on caching my PHPmyAdmin subdomain or lesser used sites. Setup is Nginx, php-fpm, and apc.

From what I've read the filter setting of APC cannot match against full path so I am looking for some other method.

share|improve this question
up vote 1 down vote accepted

You would have to set up two separate pools of php "workers" in your php-fpm.conf, each using a different php_defines as well as a different port. One would have APC enabled, one would not. How to enable or disable APC would depend on if you built it into the PHP executable or not. If it is built in, you'd add apc.enabled=0 in one php_defines to disable it in that worker pool. Otherwise, you'd remove the from your default .ini file and move it into one of the php_defines to enable it in that worker pool.

In nginix, you should be able to set which worker pool gets used on a per-location basis by putting the correct port in fastcgi_pass. You could test if its working or not by creating a small script calling phpinfo() in each location and checking the output for APC.

share|improve this answer
Happy to hear there's support for multiple pools. I thought that I might have to install php-fpm twice and rename the second instance and do some other nastiness. I get the gist and will check the documentation for specifics. Do you have any additional reference material? Thanks! – CarpeNoctem Jan 18 '11 at 8:40
I think the APC flag is called apc.enabled=0 – liecno Apr 30 '13 at 14:02
@liecno thanks, I fixed it. – DerfK Apr 30 '13 at 17:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.