使APC转储缓存文件的二进制操作码失败?

时间:2011-12-01 11:04:42

标签: php apc

main.php:

require "/root/test.php";
print_r(apc_cache_info());
apc_bin_dump(array("/root/test.php"));

test.php的:

$x = "a";
echo $x;

test.php成功执行并且“a”被回显。

apc_cache_info()显示两个文件都已缓存:

[...]
 [cache_list] => Array
        (
            [0] => Array
                (
                    [type] => file
                    [device] => 2049
                    [inode] => 26472
                    [filename] => /root/test.php
                    [num_hits] => 0
                    [mtime] => 1322736219
                    [creation_time] => 1322737193
                    [deletion_time] => 0
                    [access_time] => 1322737193
                    [ref_count] => 0
                    [mem_size] => 4168
                )

            [1] => Array
                (
                    [type] => file
                    [device] => 2049
                    [inode] => 26476
                    [filename] => /root/main.php
                    [num_hits] => 0
                    [mtime] => 1322736869
                    [creation_time] => 1322737193
                    [deletion_time] => 0
                    [access_time] => 1322737193
                    [ref_count] => 0
                    [mem_size] => 4168
                )

        )
[...]

但是apc_bin_dump这一行产生了一个“神秘”警告:

    :PHP Warning:  apc_bin_dump(): Excluding some files from apc_bin_dump[file].  Cached files must be included using full path with apc.stat=0. in /root/main.php on line 5
PHP Stack trace:
PHP   1. {main}() /root/main.php:0
PHP   2. apc_bin_dump() /root/main.php:5
PHP Warning:  apc_bin_dump(): Excluding some files from apc_bin_dump[file].  Cached files must be included using full path with apc.stat=0. in /root/main.php on line 5
PHP Stack trace:
PHP   1. {main}() /root/main.php:0
PHP   2. apc_bin_dump() /root/main.php:5

出了什么问题?


CLI的APC设置:

apc

APC Support => enabled
Version => 3.1.7
APC Debugging => Disabled
MMAP Support => Enabled
MMAP File Mask =>
Locking type => pthread mutex Locks
Serialization Support => php
Revision => $Revision: 307215 $
Build Date => Feb 27 2011 19:39:21

Directive => Local Value => Master Value
apc.cache_by_default => On => On
apc.canonicalize => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => On => On
apc.enabled => On => On
apc.file_md5 => Off => Off
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => Off => Off
apc.lazy_classes => Off => Off
apc.lazy_functions => Off => Off
apc.max_file_size => 1M => 1M
apc.mmap_file_mask => no value => no value
apc.num_files_hint => 1000 => 1000
apc.preload_path => no value => no value
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.serializer => default => default
apc.shm_segments => 1 => 1
apc.shm_size => 32M => 32M
apc.slam_defense => On => On
apc.stat => On => On
apc.stat_ctime => Off => Off
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 0 => 0
apc.write_lock => On => On

1 个答案:

答案 0 :(得分:2)

它写在消息本身

  

必须使用apc.stat = 0

的完整路径包含缓存文件

,您的设置为

apc.stat => On => On

禁用apc.stat或不使用apc_bin_dump()。该消息告诉您,两者都不可能(无论出于何种原因)。