有了一个新的服务器,主机为我安装了 APC。
重新加载 apc.php 会显示 ACP 每 4-6 秒重置一次。正常运行时间始终为 0,点击次数从未超过 3000。
网站运行顺畅,但是如果 APC 真的一次又一次地重新启动,我希望修复这个问题。
error_log 没有显示错误。我唯一能找到的是运行某个 php 脚本时出现的 cronjob 错误PHP Warning: Module 'apc' already loaded in Unknown on line 0
。
眼镜:
Ubuntu 12.04.4 LTS
SSD harddrive
Apache/2.2.22 (Ubuntu) DAV/2 mod_fcgid/2.3.9 mod_python/3.3.1
PHP 5.3.10-1ubuntu3.11 with Suhosin-Patch (cli)
APC Version 3.1.7
apc.php快照:
Shared Memory 1 Segment(s) with 200.0 MBytes (mmap memory, pthread mutex Locks locking)
Start Time 31.05.2014 14:39:51
Uptime 0 minutes
File Upload Support 1
File Cache Information
Cached Files 161 (24.4 MBytes)
Hits 2423
Misses 161
Request Rate (hits, misses) 136.00 cache requests/second
Hit Rate 127.53 cache requests/second
Miss Rate 8.47 cache requests/second
Insert Rate 8.58 cache requests/second
Cache full count 0
User Cache Information
Cached Variables 0 (0.0 Bytes)
Hits 0
Misses 0
Request Rate (hits, misses) 0.00 cache requests/second
Hit Rate 0.00 cache requests/second
Miss Rate 0.00 cache requests/second
Insert Rate 0.00 cache requests/second
Cache full count 0
Runtime Settings
apc.cache_by_default 1
apc.canonicalize 1
apc.coredump_unmap 0
apc.enable_cli 0
apc.enabled 1
apc.file_md5 0
apc.file_update_protection 2
apc.filters [path to my apc.php]
apc.gc_ttl 3600
apc.include_once_override 0
apc.lazy_classes 0
apc.lazy_functions 0
apc.max_file_size 2M
apc.mmap_file_mask
apc.num_files_hint 7000
apc.preload_path
apc.report_autofilter 0
apc.rfc1867 0
apc.rfc1867_freq 0
apc.rfc1867_name APC_UPLOAD_PROGRESS
apc.rfc1867_prefix upload_
apc.rfc1867_ttl 3600
apc.serializer default
apc.shm_segments 1
apc.shm_size 200M
apc.slam_defense 1
apc.stat 0
apc.stat_ctime 0
apc.ttl 7200
apc.use_request_time 1
apc.user_entries_hint 4096
apc.user_ttl 7200
apc.write_lock 1
答案1
问题是mod_fcgid
阅读它的手册页:
http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
无法共享操作码缓存,这就是为什么当 apc 刷新时你会看到不同的缓存...... 苏普也是邪恶的。
使用mod_fastcgi和php-fpm
ps 需要设置一些 apc 配置apc.enable_opcode_cache = 1