APC (PHP Cache) Uptime 0 minutes, not caching

断了今生、忘了曾经 提交于 2019-12-10 16:14:37

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/6828667/apc-php-cache-uptime-0-minutes-not-caching

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!