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'配置命令我没有找到apc
'./configure' '--disable-cli' '--禁用丢弃路径' '--禁用强制 cgi 重定向' '--prefix=/usr/local/php5' '--with-config-file-path=/usr/local/lib/php5' '--with-pear=/usr/share/php5' '--启用 exif' '--启用 ftp' '--启用 bcmath' '--启用日历' '--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' '--enable-mbregex' '--with-mysql=/usr' '--with-mysqli' '--with-curl' '--with-xsl'
$bar = 'BAR';
apc_store('foo', $bar);
var_dump(apc_fetch('foo'));
Within one request this work.
Now If i try to do a var_dump(apc_fetch('foo'));
on another request it prints:
bool(false)
Any help?
I am on gentoo with PHP 5.2, APC-3.1.9
Here what phpinfo() knows about 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
If you need other infos please tell me
Here is how I installed it: https://serverfault.com/questions/274261/failed-installing-apc
I noticed one thing: In the phpinfo' Configure command i didn't find 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'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能您正在通过 CGI 运行 PHP(而不是您应该使用的 FastCGI) - 请参阅 我在另一个问题中的回答为什么如果 PHP 在 CGI 上运行,APC 不起作用。
Probably you are running PHP over CGI (instead of FastCGI which you ought to use) - see my answer in another question why APC doesn't work if PHP is running over CGI.
您的默认 ttl (apc.ttl) 是 0 秒,这很奇怪 - 请尝试在存储值时指定 ttl(以秒为单位):
Your default ttl (apc.ttl) is 0 seconds, that is strange - please try to specify a ttl (in seconds) when storing the value:
php.ini 的内容
apctest.php 的内容
apctest.php 的结果 apctest2.php
的内容 apctest2.php
的结果
apc.php 显示在“用户缓存条目”下
软件版本:
Content of php.ini
Content of apctest.php
Result of apctest.php
Content of apctest2.php
Result of apctest2.php
apc.php shows under "Users Cache Entries"
Software versions: