如果您通过PHP的CLI SAPI使用APCu函数时收到以下警告:
PHP Warning: apcu_cache_info(): No APC info available. Perhaps APC is not enabled? Check apc.enabled in your ini file
那么请检查`apc.enable_cli`的状态。这是一个单独的INI条目,用于通过CLI SAPI启用APC。
(PECL apcu >= 4.0.0)
apcu_cache_info — 检索APCu数据存储中的缓存信息
版本 | 描述 |
---|---|
PECL apcu 3.0.11 | 引入了limited 参数。 |
PECL apcu 3.0.16 | 引入了cache_type 参数的"filehits "选项。 |
示例 #1 一个 apcu_cache_info() 示例
<?php
print_r(apcu_cache_info());
?>
以上示例将输出类似于以下内容
Array ( [num_slots] => 2000 [ttl] => 0 [num_hits] => 9 [num_misses] => 3 [start_time] => 1123958803 [cache_list] => Array ( [0] => Array ( [filename] => /path/to/apcu_test.php [device] => 29954 [inode] => 1130511 [type] => file [num_hits] => 1 [mtime] => 1123960686 [creation_time] => 1123960696 [deletion_time] => 0 [access_time] => 1123962864 [ref_count] => 1 [mem_size] => 677 ) [1] => Array (...iterates for each cached file) )
如果您通过PHP的CLI SAPI使用APCu函数时收到以下警告:
PHP Warning: apcu_cache_info(): No APC info available. Perhaps APC is not enabled? Check apc.enabled in your ini file
那么请检查`apc.enable_cli`的状态。这是一个单独的INI条目,用于通过CLI SAPI启用APC。