disabe OPcache for specific website

Kaden asked:

Problem: Running OPCache on web server with production site and Development site causes problems when editing the development site, because PHP pages are cached.

Question: Is it possible to turn OPCache off ONLY for the development site, but leave it on for the production website? My dev site is on the same OS, so obviously they are using the same PHP-FPM service.

My answer:


Since your site is small, there’s no real need to have OPcache not rechecking files on each request. Set opcache.validate_timestamps to true and opcache.revalidate_freq to 0, to have OPcache check whether the file is modified on every request.

When you actually have enough traffic for it to matter, you can run each site on a separate php-fpm pool, each with different settings. Though, it’s been my experience that this performance tweak (disabling validate_timestamps) saves so little time in comparison to everything else PHP is doing that it’s not very useful at all.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.