1

我的 Ubuntu 13.04 Server 机器上运行 APC 已经有一段时间了。几天前,某个地方出了问题,现在它的行为非常奇怪。我会列出来的。

我的 PHP 配置文件位于/etc/php5/mods-available. PHP5 的所有配置目录(/etc/php5/cli/conf.d/etc/php5/fpm/conf.d等)都被符号链接到,而这些目录/etc/php5/conf.d/又被符号链接到/etc/php5/mods-available. 如果我php -i从 shell 运行,我会得到/etc/php5/cli/conf.d/*返回的配置文件,它应该与任何地方的配置文件完全相同。我的问题的相关部分是:

apc

APC Support => disabled
Version => 3.1.13
APC Debugging => Disabled
MMAP Support => Enabled
MMAP File Mask => /tmp/apc.XXXXXX
Locking type => pthread mutex Locks
Serialization Support => broken
Revision => $Revision: 327136 $
Build Date => Oct  9 2012 20:29:11

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 => /tmp/apc.XXXXXX => /tmp/apc.XXXXXX
apc.num_files_hint => 512 => 512
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 => 128M => 128M
apc.shm_strings_buffer => 4M => 4M
apc.slam_defense => On => On
apc.stat => On => On
apc.stat_ctime => Off => Off
apc.ttl => 3600 => 3600
apc.use_request_time => On => On
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 7200 => 7200
apc.write_lock => On => On

这将选项显示apc.enabled为打开。但是,我的 phpinfo.php(上面的链接)显示了 PHP5-FPM 的配置(来自/etc/php5/fpm/conf.d)显示此选项为关闭。问题是,命令行版本的 php (cli) 和在我的网络服务器上运行的版本 (fpm) 使用完全相同的符号链接配置文件。

我的 APC 似乎正在缓存,但它的行为很奇怪。在我清空缓存并重新加载我服务器上安装的 Wordpress 上的一些页面之前,我会看到页面立即被缓存。现在,它在相同的命中数和未命中数上停留了几个小时,我可以随心所欲地刷新,没有任何变化。

apc.enabled选项也显示为0(关闭)apc.php,但它似乎至少在做某事。操作码缓存和用户缓存中都有文件。它的行为很奇怪,我从 PHP 返回了很多相互矛盾的设置。我在这里不知所措。这是20-apc.ini一个很好的衡量标准:

extension=apc.so
apc.enabled="1"
apc.stat = "1"
apc.max_file_size = "1M"
apc.localcache = "1"
apc.localcache.size = "128"
apc.shm_segments = "1"
apc.ttl = "3600"
apc.user_ttl = "7200"
apc.gc_ttl = "3600"
apc.cache_by_default = "1"
apc.filters = ""
apc.write_lock = "1"
apc.num_files_hint= "512"
apc.user_entries_hint="4096"
apc.shm_size = "128M"
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.include_once_override = "0"
apc.file_update_protection="2"
apc.canonicalize = "1"
apc.report_autofilter="0"
apc.stat_ctime="0"

如果有人需要任何其他配置文件或其中的一部分,我会密切关注这个线程,请告诉我。

4

0 回答 0