APC(PHP 缓存)正常运行时间 0 分钟,不缓存

发布于 2024-11-26 05:21:00 字数 3337 浏览 1 评论 0原文

我的目标是为 drupal 6 生产站点实现操作码缓存的 APC。 到目前为止,我已经使用几个 php 文件测试了 APC,无论是否使用 include_once 包含其他 php 文件。

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

导致 apc.php 没有显示任何值的任何更改。 (当然,更改后的 apc.ini 值按其应有的方式显示除外)

每次我刷新 apc.php 测试页面时,开始时间都会重置为当前时间,显示正常运行时间 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 设置是否会阻止缓存: 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 @ 主机身份登录和启动时,也无法识别 suexec 命令

,而且我几乎确信没有 cPanel 在主机上运行主机检查那里的设置是否会在某个时间间隔重置正在运行的缓存进程,

这让我几乎没有下一步该去哪里的线索。 我尝试将 apache 设置为(使用 chown 和 chgrp)apc.php 文件和一些测试 php 文件的所有者,导致 500 服务器错误。

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

My goal is to implement APC for opcode cache for a drupal 6 production site.
I have so far tested APC with several php files with and without including other php files with include_once.

Also tried to tweak the apc.ini values for shm_size, apc.include_once_override and apc.stat.
Restarted apache every time.

Resulting in apc.php not showing any changes in any values. (except of course the changed apc.ini values are shown as they should)

Every time i refresh the apc.php test page, the start time resets as the current time showing uptime 0 minutes.

apc.php -testpage shows:

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 shows:

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

I followed these steps to find if suexec settings would prevent 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

..indicates that there is no lsphp running on the host

also I read the following article and comments, concluding that in my case the problem is not the suexec as the user apache is the httpd process owner
http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/

also suexec command is not recognized when logged and launced as root @ host

also i'm almost confident that there is no cPanel running on the host to check if a setting there would reset the running cache process at some interval

This leaves me with few clues where to head next.
I tried to set (with chown and chgrp) apache as the owner of the apc.php file and some test php files resulting in 500 server error.

Is there a way to check if the file permissions prevent the apc stay running?
I'm tremendously grateful for any suggestions or help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦过后 2024-12-03 05:21:00

你能给 APC 的 php.ini 设置吗?

您必须重新启动 httpd 才能使设置更改生效。

尝试更改最大文件大小

apc.max_file_size = 20M

您允许 128M 的 RAM,对于像我们今天这样的大型 php 应用程序来说相当低(单个 WordPress 使用 32M)

apc.shm_size    128M

也可以增加它

Can you give your php.ini settings for APC ?

You must restart httpd to take setting change into account.

Try to change max file size

apc.max_file_size = 20M

You are alowing 128M of ram, it's quite low for big php applications like we have today (a single wordpress uses 32M)

apc.shm_size    128M

increase it also

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文