Php APC不能正常工作

Php APC不能正常工作,php,caching,apc,Php,Caching,Apc,我刚刚用PHP处理程序FastCGI安装了APC。但缓存似乎从未运行过 if(($t=apc_fetch('key_4321'))===FALSE){ $t=time(); apc_add('key_4321', $t, 24*60*60); } echo $t; 几乎每次我运行它都会得到不同的时间戳。只有几次结果保持不变。可能的原因是什么? 我使用的是PHP版本5.3.21,服务器API是CGI/FastCGI。下面是我的APC设置 Configuration apc

我刚刚用PHP处理程序FastCGI安装了APC。但缓存似乎从未运行过

if(($t=apc_fetch('key_4321'))===FALSE){
    $t=time();
    apc_add('key_4321', $t, 24*60*60);
}

echo $t;
几乎每次我运行它都会得到不同的时间戳。只有几次结果保持不变。可能的原因是什么?

我使用的是PHP版本5.3.21,服务器API是CGI/FastCGI。下面是我的APC设置

Configuration

apc

APC Support enabled
Version 3.1.13
APC Debugging   Disabled
MMAP Support    Enabled
MMAP File Mask  no value
Locking type    File Locks
Serialization Support   php
Revision    $Revision: 327136 $
Build Date  Feb 7 2013 21:44:30

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  36000   36000
apc.include_once_override   On  On
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    256M    256M
apc.slam_defense    On  On
apc.stat    On  On
apc.stat_ctime  Off Off
apc.ttl 36000   36000
apc.use_request_time    On  On
apc.user_entries_hint   4096    4096
apc.user_ttl    72000   72000
apc.write_lock  On  On

cgi-fcgi

Directive   Local Value Master Value
cgi.check_shebang_line  1   1
cgi.discard_path    0   0
cgi.fix_pathinfo    1   1
cgi.force_redirect  1   1
cgi.nph 0   0
cgi.redirect_status_env no value    no value
cgi.rfc2616_headers 0   0
fastcgi.logging 1   1

你确定你是通过FastCGI而不仅仅是CGI运行的吗?根据这篇文章,如果你在CGI下运行,那么它将解释你的问题


如何确认我使用的是哪一个?嗨@Cody,我刚检查过<代码>服务器软件Apache/2.2.23(Unix)mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_fcgid/2.3.6