php - apc_store 在请求之间不工作

标签 php linux apc gentoo

$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 的配置命令中我没有找到 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' '--enable-sysvshm' '--with-mcrypt' '--with-iconv' '--enable-mbstring=all' '--enable-mbregex' '--with-mysql=/usr' '--with-mysqli' '--with-curl' '--with-xsl'

最佳答案

可能您正在通过 CGI(而不是您应该使用的 FastCGI)运行 PHP - 请参阅 my answer in another question如果 PHP 在 CGI 上运行,为什么 APC 不工作。

关于php - apc_store 在请求之间不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6152526/

相关文章:

php - 使用 PHP 将时间戳转换为可读的日期/时间

php - 我无法回显包含值的 JSON 编码对象

php - Laravel 日期不允许我使用 diffForHumans

php - pecl install apc 不工作。 shtool 不存在

php - 使用 EasyPHP 安装 APC

php - 在 CentOS 上使用 PHP 5.4 安装 APC(主干)

javascript - responseText 数组无法正确解析

linux - 我怎样才能破译替代密码?

c++ - 无法用 64 位 g++ 编译 32 位

linux - 如何在 ksh 中导出函数?没有全局声明或使用自动加载