APC(PHPcaching)正常运行时间0分钟,不caching

我的目标是为一个drupal 6生产站点实现操作码caching的APC。 到目前为止,我已经用一些php文件testing了APC,包括include_once和不包括其他php文件。

还尝试调整shm_size,apc.include_once_override和apc.stat的apc.ini值。 每次重新启动apache。

导致apc.php不显示任何值的任何更改。 (当然除了改变后的apc.ini值是应该显示的)

每次我刷新apc.phptesting页面,开始时间重置为当前时间显示正常运行时间0分钟。

apc.php -testpage显示:

General Cache InformationAPC Version 3.1.9 PHP Version 5.2.10 APC Host xxxx.xx.xx Server Software Apache/2.2.3 (CentOS) Shared Memory 1 Segment(s) with 128.0 MBytes (mmap memory, pthread mutex Locks locking) Start Time 2011/07/26 11:53:56 Uptime 0 minutes File Upload Support 1 Cached Files 0 ( 0.0 Bytes) Hits 1 Misses 1 Request Rate (hits, misses) 2.00 cache requests/second Hit Rate 1.00 cache requests/second Miss Rate 1.00 cache requests/second Insert Rate 0.00 cache requests/second Cache full count 0 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 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 apc.gc_ttl 3600 apc.include_once_override 0 apc.lazy_classes 0 apc.lazy_functions 0 apc.max_file_size 16 apc.mmap_file_mask /tmp/apcphp5.095eRm apc.num_files_hint 1024 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 128M apc.slam_defense 0 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 Host Status Diagrams: Free: 128.0 MBytes (100.0%) Hits: 1 (50.0%) Used: 20.3 KBytes (0.0%) Misses: 1 (50.0%) Detailed Memory Usage and Fragmentation: Fragmentation: 0% 

phpinfo显示:

 Server API CGI/FastCGI APC: Version 3.1.9 APC Debugging Enabled MMAP Support Enabled MMAP File Mask /tmp/apcphp5.JkKDk7 Locking type pthread mutex Locks Serialization Support php Revision $Revision: 308812 $ Build Date Jul 21 2011 14:31:12 

我遵循这些步骤来查找suexec设置是否会阻止caching: http : //www.litespeedtech.com/support/forum/showthread.php? t=4189

 [root@host /]# ps -ef|grep lsphp root 20402 17833 0 11:21 pts/0 00:00:00 grep lsphp [root@host /]# ps -waux root 17833 0.0 0.1 5004 1484 pts/0 S 10:39 0:00 bash 

..表示主机上没有运行lsphp

我也读了下面的文章和评论,得出结论,在我的情况下,问题不是suexec,因为用户apache是​​httpd进程所有者http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/

当以root @ host身份login并启动时,也不会识别suexec命令

另外我几乎相信,主机上没有运行cPanel来检查是否有一个设置会在一定的时间间隔重置正在运行的caching进程

这让我没有什么线索可以在哪里接下来。 我试图设置(与chown和chgrp)apache作为apc.php文件的所有者和一些testingphp文件导致500服务器错误。

有没有办法检查文件权限是否阻止apc保持运行? 我非常感激任何build议或帮助。

您的configuration显示apc.max_file_size被设置为16 个字节 。 所以没有大于16个字节的文件(以及它们都是!)将被caching。 我会重置这个默认的1M

你在这个主机上启用了SELinux吗? 用getenforce检查一下。 如果它返回Enforcing ,则启用。

如果它启用,你不需要它,尝试暂时(直到下一次重新启动,即)禁用它与setenforce 0 。 如果这可以解决你的问题,你需要永久禁用SELinux,修改/etc/selinux/config文件,并将其设置为在那里禁用。 或者,您可以尝试修改SELinux以使其更加宽容,但这是另一个话题,如果这真的是因为SELinux的缘故,我们将回到这个话题。 🙂

编辑:好的,然后,SELinux被禁用。

你看到/tmp/apcphp5.JkKDk7时髦的文件出现在/ tmp下吗?

我有同样的问题。 这是一个tmp问题。 设置mmap_file_mask到/ dev / zero得到它caching。 在相同的用户名下发布在drupal.org上的详细信息。

如果没有以正确的权限装载,则在tmp上设置权限将无济于事。

如果有人发现这个寻找类似的问题,你可能需要检查apc.enable_opcode_cache = 1

“在开发分支(3.1.5dev)中,引入了一个选项来禁用操作码caching(apc.enable_opcode_cache = 0),允许严格使用Zend OPcache和APC来处理用户数据。 -Remi博客