Bug #75070 [NEW]: opcache_get_status returns opcache_enabled=false
| From: | humbads at alum dot mit dot edu | Date: | Sun, 13 Aug 2017 14:35:11 +0000 |
| Subject: | Bug #75070 [NEW]: opcache_get_status returns opcache_enabled=false | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210653@lists.php.net to get a copy of this message | ||
From: humbads at alum dot mit dot edu
Operating system: FreeBSD 10.3-RELEASE-p11
PHP version: 7.0.22
Package: opcache
Bug Type: Bug
Bug description:opcache_get_status returns opcache_enabled=false
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 bug report at https://bugs.php.net/bug.php?id=75070&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75070&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75070&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75070&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75070&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75070&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75070&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75070&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75070&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75070&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75070&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75070&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75070&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75070&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75070&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75070&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75070&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75070&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75070&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75070&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75070&r=mysqlcfg