In PHP Opcache there is an option opcache.use_cwd. Disabling it improves performance, but in documentation mentioned that this may break existing applications:

If enabled, OPcache appends the current working directory to the script key, thereby eliminating possible collisions between files with the same base name. Disabling this directive improves performance, but may break existing applications.

I would like know will Drupal break by disabling opcache.use_cwd? I know Drupal has a lot of files with same base name.


It really depends on your server and Drupal sites setup.

opcache.use_cwd=0 can ONLY be used if you can ensure that there is no duplicate filenames in the PHP files that the server PHP engine may run.

Note that PHP files are not only those with .php extension, but any of them that begin with the php symbol, like .module, .inc, .install, .tpl.php and so on (whatever extension could be used really).

There are a lot of Drupal setups where these duplicate filenames exists, so opcache.use_cwd=0 must not be used, like:

  • Overriden core tpl files from your custom theme or sub-theme.
  • Multisite configurations, or multiple drupal installations running in the same PHP engine.

Note that in a single PHP engine, OpCache (if active) is shared between ALL the PHP files that are running on it, so name collisions will happen if any filename is duplicated, if the subdirectory info is not appended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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