Bug->Doc #75070 [Opn]: opcache_get_status returns opcache_enabled=false
| From: | humbads at alum dot mit dot edu | Date: | Thu, 17 Aug 2017 13:38:02 +0000 |
| Subject: | Bug->Doc #75070 [Opn]: opcache_get_status returns opcache_enabled=false | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14897@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75070&edit=1
ID: 75070
User updated by: humbads at alum dot mit dot edu
Reported by: humbads at alum dot mit dot edu
Summary: opcache_get_status returns opcache_enabled=false
Status: Open
-Type: Bug
+Type: Documentation Problem
Package: opcache
Operating System: FreeBSD 10.3-RELEASE-p11
PHP Version: 7.0.22
Block user comment: N
Private report: N
New Comment:
I confirmed this behavior on PHP 7.0.22 on Windows 10. When I change opcache.file_cache_only to
"0", then opcache_enabled changes to "true" and all the statistics appear.
opcache_enabled seems to only indicate the status of memory cache, not opcache in general. I
changed this from a bug to a documentation problem. It would be nice if all the values returned by
opcache_get_status were documented.
Previous Comments:
------------------------------------------------------------------------
[2017-08-13 14:35:04] humbads at alum dot mit dot edu
Description:
------------
Running PHP CLI, opcache_get_status returns opcache_enabled=false when file_cache_only=1. It should
return opcache_enabled=true, unless that only applies to the SHM cache. If that's the case,
then the documentation should make that clear. The documentation should also indicate that detailed
statistics will not be available when file-only caching is turned on, although that's a little
easier to understand why.
PHPinfo reports "Opcode Caching => Up and Running", and I see the .php.bin files being
generated and updated in the file cache folder. So it does seem that opcache is enabled and working
for CLI.
Here is some more configuration information:
Results of opcache_get_configuration:
array(3) {
["directives"]=>
array(30) {
["opcache.enable"]=>
bool(true)
["opcache.enable_cli"]=>
bool(true)
["opcache.use_cwd"]=>
bool(true)
["opcache.validate_timestamps"]=>
bool(true)
["opcache.validate_permission"]=>
bool(false)
["opcache.validate_root"]=>
bool(false)
["opcache.inherited_hack"]=>
bool(true)
["opcache.dups_fix"]=>
bool(false)
["opcache.revalidate_path"]=>
bool(false)
["opcache.log_verbosity_level"]=>
int(1)
["opcache.memory_consumption"]=>
int(67108864)
["opcache.interned_strings_buffer"]=>
int(4)
["opcache.max_accelerated_files"]=>
int(2000)
["opcache.max_wasted_percentage"]=>
float(0.05)
["opcache.consistency_checks"]=>
int(0)
["opcache.force_restart_timeout"]=>
int(180)
["opcache.revalidate_freq"]=>
int(2)
["opcache.preferred_memory_model"]=>
string(0) ""
["opcache.blacklist_filename"]=>
string(0) ""
["opcache.max_file_size"]=>
int(0)
["opcache.error_log"]=>
string(0) ""
["opcache.protect_memory"]=>
bool(false)
["opcache.save_comments"]=>
bool(true)
["opcache.fast_shutdown"]=>
bool(true)
["opcache.enable_file_override"]=>
bool(false)
["opcache.optimization_level"]=>
int(2147467263)
["opcache.lockfile_path"]=>
string(4) "/tmp"
["opcache.file_cache"]=>
string(20) "/var/tmp/php_opcache"
["opcache.file_cache_only"]=>
bool(true)
["opcache.file_cache_consistency_checks"]=>
bool(true)
}
["version"]=>
array(2) {
["version"]=>
string(6) "7.0.22"
["opcache_product_name"]=>
string(12) "Zend OPcache"
}
["blacklist"]=>
array(0) {
}
}
Results of phpinfo();
Zend OPcache
Opcode Caching => Up and Running
Optimization => Enabled
SHM Cache => Disabled
File Cache => Enabled
Startup => OK
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 => On => On
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.fast_shutdown => 1 => 1
opcache.file_cache => /var/tmp/php_opcache => /var/tmp/php_opcache
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_only => 1 => 1
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => Off => Off
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 4 => 4
opcache.lockfile_path => /tmp => /tmp
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.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
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_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On
Test script:
---------------
php -r 'var_dump(opcache_get_configuration());'
php -r 'phpinfo();'
php -r 'var_dump(var_dump(opcache_get_status());'
Expected result:
----------------
array(3) {
["opcache_enabled"]=>
bool(true)
["file_cache"]=>
string(20) "/var/tmp/php_opcache"
["file_cache_only"]=>
bool(true)
}
Actual result:
--------------
array(3) {
["opcache_enabled"]=>
bool(false)
["file_cache"]=>
string(20) "/var/tmp/php_opcache"
["file_cache_only"]=>
bool(true)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75070&edit=1