Edit report at https://bugs.php.net/bug.php?id=71292&edit=1
ID: 71292
Updated by: ab@php.net
Reported by: dev at models dot com
Summary: Opcache settings have no effect, only default
settings are loaded
Status: Feedback
Type: Bug
Package: opcache
Operating System: Windows Server 2008 R2 / IIS
PHP Version: 7.0.1
Block user comment: N
Private report: N
New Comment:
Now, please be a bit more verbose. "SHM Cache Enabled" means there was no fallback
required, but the file_cache value is still empty in your latest posting. That means the file where
you set the file cache directive was not read in, for some reasons.
What was in the event, same as before about the "invalid address"? If yes, that' s
another sign the php.ini doesn't even got read in. Please check what is the path to your
php.ini shown in the phpinfo page, and check that you properly set it for the PHP environment.
Maybe there a specific PHP code leading to this?
Anatol
Previous Comments:
------------------------------------------------------------------------
[2016-01-06 20:52:19] dev at models dot com
Thanks for responding.
I added these two directives:
opcache.file_cache_fallback=1
opcache.file_cache="path to a server writable directory"
Then recycled the app pool,
At first the page was not responding (blank) and the windows log generated an Event ID 487 for each
request.
After doing another recycle php pages started responding again, but the ini settings are still not
applied or changing.
I can verify that the app pool is recycled, as every time I do it the "Cache hits" counter
resets itself to 0 an starts incrementing back up for each request to the phpinfo() page.
The new opcache.cache_file is still showing as undefined.
This is the output of phpinfo() after doing those changes:
Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
Startup OK
Shared memory model win32
Cache hits 5
Cache misses 1
Used memory 9132712
Free memory 57976152
Wasted memory 0
Interned Strings Used memory 132024
Interned Strings Free memory 4062280
Cached scripts 1
Cached keys 2
Max keys 3907
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
Directive Local Value Master Value
opcache.blacklist_filename no value no value
opcache.consistency_checks 0 0
opcache.dups_fix Off Off
opcache.enable On On
opcache.enable_cli Off Off
opcache.enable_file_override Off Off
opcache.error_log no value no value
opcache.fast_shutdown 0 0
opcache.file_cache no value no value
opcache.file_cache_consistency_checks 1 1
opcache.file_cache_fallback 1 1
opcache.file_cache_only 0 0
opcache.file_update_protection 2 2
opcache.force_restart_timeout 180 180
opcache.inherited_hack On On
opcache.interned_strings_buffer 4 4
opcache.log_verbosity_level 1 1
opcache.max_accelerated_files 2000 2000
opcache.max_file_size 0 0
opcache.max_wasted_percentage 5 5
opcache.memory_consumption 64 64
opcache.mmap_base no value no value
opcache.optimization_level 0xFFFFFFFF 0xFFFFFFFF
opcache.preferred_memory_model no value no value
opcache.protect_memory 0 0
opcache.restrict_api no value no value
opcache.revalidate_freq 2 2
opcache.revalidate_path Off Off
opcache.save_comments 1 1
opcache.use_cwd On On
opcache.validate_timestamps On On
------------------------------------------------------------------------
[2016-01-06 18:23:56] ab@php.net
Thanks for the report. Yes, it is the know issue that sometimes reattaching to SHM fails.
In 7.0 the INI directive opcache.file_cache_fallback was added, to still make use of the file cache
in this situation. In your configuration, opcache.file_cache= has no value, thus the fallback cannot
work. Please set a valid path as a value and observe the happenings.
Thanks.
------------------------------------------------------------------------
[2016-01-05 22:01:36] dev at models dot com
Adding more info, we are also seeing these errors in the Windows Application log:
Source: Zend OPcache
Event ID: 487
Base address marks unusable memory region
Attempt to access invalid address.
Which seems to be the same issue or related to the one described here:
https://github.com/zendtech/ZendOptimizerPlus/issues/167
and in this php bug report:
https://bugs.php.net/bug.php?id=64926
------------------------------------------------------------------------
[2016-01-05 20:22:10] dev at models dot com
Description:
------------
Changing any of the opcache. settings after having enabled the extension in php.ini has no effect on
any of the settings.
The only thing that seems to work is loading or unloading the opcache extension adding or removing
the zend_extension="full path to opcache dll" option.
Opcache is enabled and loaded, verified via phpinfo() which reports that the opcache module is
loaded and enabled.
This is on Windows Server 2008 R2, running php 7.0.1 x64 nts in fastcgi mode.
Making the same changes on php 5.5.29 on the same server works properly, opcache settings can be
changed via php.ini and new settings are reported by phpinfo().
Test script:
---------------
The info reported by phpinfo() is as follows:
Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
Startup OK
Shared memory model win32
Cache hits 0
Cache misses 1
Used memory 9132712
Free memory 57976152
Wasted memory 0
Interned Strings Used memory 132024
Interned Strings Free memory 4062280
Cached scripts 1
Cached keys 2
Max keys 3907
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
Directive Local Value Master Value
opcache.blacklist_filename no value no value
opcache.consistency_checks 0 0
opcache.dups_fix Off Off
opcache.enable On On
opcache.enable_cli Off Off
opcache.enable_file_override Off Off
opcache.error_log no value no value
opcache.fast_shutdown 0 0
opcache.file_cache no value no value
opcache.file_cache_consistency_checks 1 1
opcache.file_cache_fallback 1 1
opcache.file_cache_only 0 0
opcache.file_update_protection 2 2
opcache.force_restart_timeout 180 180
opcache.inherited_hack On On
opcache.interned_strings_buffer 4 4
opcache.log_verbosity_level 1 1
opcache.max_accelerated_files 2000 2000
opcache.max_file_size 0 0
opcache.max_wasted_percentage 5 5
opcache.memory_consumption 64 64
opcache.mmap_base no value no value
opcache.optimization_level 0xFFFFFFFF 0xFFFFFFFF
opcache.preferred_memory_model no value no value
opcache.protect_memory 0 0
opcache.restrict_api no value no value
opcache.revalidate_freq 2 2
opcache.revalidate_path Off Off
opcache.save_comments 1 1
opcache.use_cwd On On
opcache.validate_timestamps On On
Changing any of the corresponding settings in php.ini and restarting iis/recycling the app pool has
no effect, the settings remain the same.
This is the [opcache] settings section of our php.ini file.
I have verified the correct php.ini is loaded, other custom settings are applied and reported by
phpinfo()
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=8000
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.revalidate_freq=30
opcache.fast_shutdown=1
Expected result:
----------------
Expecting php.ini changes to opcache. settings to be reported by phpinfo()
Actual result:
--------------
phpinfo() always reports the default values for opcache configruation options.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71292&edit=1