|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-08-17 13:38 UTC] humbads at alum dot mit dot edu
-Type: Bug
+Type: Documentation Problem
[2017-08-17 13:38 UTC] humbads at alum dot mit dot edu
[2019-09-03 13:38 UTC] malone dot spencer at gmail dot com
[2021-10-15 13:31 UTC] git@php.net
[2021-10-15 13:31 UTC] git@php.net
-Status: Open
+Status: Closed
[2021-10-15 13:32 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
[2021-10-15 13:32 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 UTC |
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) }