2

Is there some way to make OPcache use a hash or target a specific directory on each domain to disable use_pwd so it won't cache the same packages over and over?

By default OPcache appends the working directory to the script key to prevent collisions. This can be toggled with the opcache.use_cwd setting but isn't really usefull on a server with multiple websites as php config files collide.

Background I have multiple Symfony, Magento 2 ect. applications running on the same server, the vendor directory is 95% of all PHP code for each of these applications creating many many duplicate files in OPcache.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47

1 Answers1

1

Yes on your opcache.config enable the following option:

    ; When this directive is enabled, the OPcache appends the current working
    ; directory to the script key, thus eliminating possible collisions between
    ; files with the same name (basename). Disabling the directive improves
    ; performance, but may break existing applications.
    opcache.use_cwd=1
albert
  • 153
  • 1
  • 7