13

How can i tell Zend Opcache not to cache any files from a specific directory. For e.g /var/www/public_html/devzone/*

I use PHP 5.5.13 with Zend OPcache v7.0.4-dev

NikiC
  • 100,734
  • 37
  • 191
  • 225
user2650277
  • 6,289
  • 17
  • 63
  • 132

1 Answers1

30

You should set the opcache.blacklist_filename configuration value with a file path to your blacklist.

The location of the OPcache blacklist file. A blacklist file is a text file containing the names of files that should not be accelerated, one per line. Wildcards are allowed, and prefixes can also be provided. Lines starting with a semi-colon are ignored as comments.


For example, create a new file:

/etc/php5/opcache-blacklist.txt

Save with your wildcard setting:

/var/www/public_html/devzone/*

And add the blacklist file path to your php.ini:

opcache.blacklist_filename=/etc/php5/opcache-blacklist.txt
Jacob Budin
  • 9,753
  • 4
  • 32
  • 35
  • 2
    I found the cause for why it's not working on Windows. Look [here](https://github.com/php/php-src/blob/6a010ad492ec82ce333fb4fee81fc46fc8e6a0a9/Zend/zend_virtual_cwd.c#L1263), this causes the opcache module to fail resolving paths from the blacklist file. To work around the problem, just don't use any wildcards in the path string. – Anateus May 22 '17 at 13:18