【问题标题】:making APC dump the binary opcode of a cached file fails?使 APC 转储缓存文件的二进制操作码失败?
【发布时间】:2011-12-01 11:04:41
【问题描述】:

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

【问题讨论】:

    标签: php apc


    【解决方案1】:

    它写在消息本身中

    必须使用 apc.stat=0 的完整路径包含缓存文件

    你的设置是

    apc.stat => On => On
    

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

    【讨论】:

    • 那是什么意思?我尝试了绝对路径和相对路径的组合。那也不行。或者你认为我应该将 apc.stat “关闭”...如果是,你知道为什么吗?
    • @Яaffael1984:请阅读我的回答直到最后:关于apc.stat。 ||不,我不知道为什么,但我暂时没有搜索原因。
    • 我们的编辑存在竞争条件;)但是,根据您的问题,此答案是完整的。如前所述,我不知道为什么不能同时使用stat=1 和函数。答案是:如果要使用该功能,设置stat=0,或者不使用该功能。
    • 我的推理哲学方法更具有整体性
    • 错误信息误导了我。我将其解释为“当您将 apc.stat 设置为零时,您必须使用完整路径。”将其设置为零也对我有用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多