微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在请求之间apc_store不起作用

如何解决在请求之间apc_store不起作用

|
$bar = \'BAR\';
apc_store(\'foo\',$bar);
var_dump(apc_fetch(\'foo\'));
一项要求之内。 现在,如果我尝试在另一个请求上执行
var_dump(apc_fetch(\'foo\'));
,它将打印:
bool(false)
有什么帮助吗? 我在gentoo上使用PHP 5.2,APC-3.1.9 这里PHPinfo()关于APC的知识:
APC Support enabled
Version 3.1.9
APC Debugging   disabled
MMAP Support    Enabled
MMAP File Mask  no value
Locking type    pthread mutex Locks
Serialization Support   PHP
Revision    $Revision: 308812 $
Build Date  May 27 2011 13:14:20

Directive   Local Value Master Value
apc.cache_by_default    On  On
apc.canonicalize    On  On
apc.coredump_unmap  Off Off
apc.enable_cli  Off Off
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
如果您需要其他信息,请告诉我 这是我的安装方式:https://serverfault.com/questions/274261/Failed-installing-apc 我注意到一件事:在PHPinfo \'Configure命令中,我没有找到apc   \'./ configure \'\'-disable-cli \'   \'-disable-discard-path \'   \'-disable-force-cgi-redirect \'   \'-prefix = / usr / local / PHP5 \'   \'-with-config-file-path = / usr / local / lib / PHP5 \'\'-with-pear = / usr / share / PHP5 \'   \'-enable-exif \'\'-enable-ftp \'   \'-enable-bcmath \'\'-enable-calendar \'   \'-with-gd \'\'-enable-gd-native-ttf \'   \'-with-freetype-dir \'\'-with-gettext \'   \'-with-zlib-dir \'\'-with-imap \'   \'-with-imap-ssl \'   \'-with-png-dir = / usr \'   \'-with-jpeg-dir = / usr \'   \'-with-xpm-dir = / usr \'\'-with-openssl \'   \'-with-kerberos \'\'-enable-sysvsem \'   \'-启用sysvshm \'\'-with-mcrypt \'   \'-with-iconv \'\'-enable-mbstring = all \'   \'-启用mbregex \'\'-with-MysqL = / usr \'   \'-with-MysqLi \'\'-with-curl \'   \'-with-xsl \'     

解决方法

        可能您是在CGI上运行PHP(而不是您应该使用的FastCGI)-在另一个问题中看到我的答案,如果PHP在CGI上运行,为什么APC不起作用。     ,        您的默认ttl(apc.ttl)为0秒,这很奇怪-请在存储值时尝试指定ttl(以秒为单位):
apc_store(\'foo\',$bar,60);
    ,        php.ini的内容
apc.enabled=\"1\"
apc.shm_segments=\"1\"
apc.shm_size=\"128M\"
apc.ttl=\"7200\"
apc.user_ttl=\"7200\"
apc.file_update_protection=\"3\"
apc.cache_by_default=\"0\"
apc.max_file_size=\"1M\"
apc.stat=\"0\"
apc.write_lock=\"1\"
apc.report_autofilter=\"0\"
apc.include_once_override=\"0\"
apc.localcache=\"1\"
apc.localcache.size=\"1024\"
apc.coredump_unmap=\"0\"
; Optional,Comment out them later on
apc.num_files_hint=\"5000\"
apc.user_entries_hint=\"5000\"
apc.gc_ttl=\"3600\"
apc.stat_ctime=\"0\"
apctest.php的内容
<?php
$bar = \'BAR\';
apc_store(\'foo\',$bar);
var_dump(apc_fetch(\'foo\'));
?>
apctest.php的结果
string \'BAR\' (length=3)
apctest2.php的内容
<?php
var_dump(apc_fetch(\'foo\'));
?>
apctest2.php的结果
string \'BAR\' (length=3)
apc.php显示在“用户缓存条目”下
User Entry Label    Hits    Size    Last accessed   Last modified   Created at  Timeout Deleted at
foo 4   656 31.05.2011 12:12:22 31.05.2011 12:05:33 31.05.2011 12:05:33 None    [Delete Now]
软件版本:
PHP Version 5.3.6
Server Version: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 SVN/1.6.9 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_fcgid/2.3.5 mod_perl/2.0.4 Perl/v5.8.8
OS: CENTOS 5.6 x86_64 standard
    ,        检查此链接可能有帮助 http://www.fastcgi.com/drupal/node/5?q=node/10 http://wiki.vpslink.com/HOWTO:_Configure_PHP_with_lighttpd_using_fastcgi     

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。