0

I'm trying to apply override PHP's opcache.max_accelerated_files setting via geerlingguy's Ansible Role for PHP onto geerlingguy/centos6's VM using the following lines (as part of provisioning script):

php_opcache_enabled_in_ini: false
php_opcache_enable_cli: 1
php_opcache_max_accelerated_files: "4096"

This seems to work (as 10-opcache.ini is created in /etc/php.d) as:

opcache.enable=1
opcache.enable_cli=1
opcache.max_accelerated_files=8192

however the option is still not overridden for PHP:

$ php -i | grep opcache.max_accelerated_files
opcache.max_accelerated_files => 4000 => 4000

This is because opcache.ini has already this settings set:

$ grep ^opcache.max_accelerated_files opcache.ini 
opcache.max_accelerated_files=4000

and somehow it takes precedence over 10-opcache.ini.

I've tried to change default php_opcache_conf_filename to opcache.ini, but then 10-opcache.ini got overridden and wiped out the previous content (including zend_extension=opcache.so line), so OPcache got disabled.

How do I change PHP setting using ansible role for PHP, so the setting is applied correctly which would override the previous value?

kenorb
  • 5,943
  • 1
  • 44
  • 53

1 Answers1

0

I think that's because 10-opcache.ini is before opcache.ini in alphabetic order, which is relevant for load order. So the config of opcache.ini is the last one applied.

You can change the filename to something like zzz-opcache.ini or my prefered way add a zzz-custom.ini with all your custom configs in one file.

On the other hand, why would you have two files for opcache? can you combine them into one?

flxPeters
  • 499
  • 4
  • 5
  • The `opcache.ini` was already provided with the VM box, `10-opcache.ini` was created by PHP ansible role. Logically `10-opcache.ini` should load first, but it doesn't happen for all settings. – kenorb Apr 21 '16 at 21:10