简体   繁体   English

APC文件缓存无法正常工作,但用户缓存很好

[英]APC File Cache not working but user cache is fine

Summary: I have PHP(5.3.8) installed as an Apache Module, and installed APC via PECL. 简介:我将PHP(5.3.8)安装为Apache模块,并通过PECL安装了APC。 The User cache is working fine but the File Cache is not working ( I do have apc.cache_by_default set to 1 so that's not the issue) 用户缓存工作正常但文件缓存不起作用(我确实将apc.cache_by_default设置为1,这不是问题)

Detail: I have just got a VPS (with cPanel/WHM) to test what gains i could get in my application with using apc file cache AND user cache. 详细信息:我刚刚获得了一个VPS(使用cPanel / WHM)来测试我使用apc文件缓存和用户缓存在我的应用程序中可以获得的收益。

So I got the PHP 5.3 compiled in as a DSO (apache module). 所以我将PHP 5.3编译为DSO(apache模块)。

Then installed APC via PECL through SSH. 然后通过SSH通过PECL安装APC。 (First I tried with WHM Module installer, it also had the same problem, so I tried it via ssh) (首先我尝试使用WHM模块安装程序,它也有同样的问题,所以我通过ssh尝试过)

All seemed fine and phpinfo showed apc loaded and enabled. 一切似乎都很好,phpinfo显示apc已加载并启用。

Then I checked with apc.php. 然后我检查了apc.php。 All seemed OK 一切似乎都好

But as I started testing my php application, the stats in apc for File Cache Information state: 但是当我开始测试我的php应用程序时,apc中的文件缓存信息状态:

Cached Files    0 ( 0.0 Bytes)  
Hits    1  
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  

Which meant no PHP files were being cached, even though I had browsed through over 10 PHP files having multiple includes. 这意味着没有缓存PHP文件,即使我浏览过10多个包含多个包含的PHP文件。 So there must have been some Cached Files. 所以一定有一些缓存文件。

But the user cache is functioning fine. 但是用户缓存运行正常。

User Cache Information  
Cached Variables    0 ( 0.0 Bytes)  
Hits    1000  
Misses  1000  
Request Rate (hits, misses) 0.84 cache requests/second  
Hit Rate    0.42 cache requests/second  
Miss Rate   0.42 cache requests/second   
Insert Rate 0.84 cache requests/second  
Cache full count    0

The above user cache output is from an APC caching test script which tries to retrieve and store 1000 entries and gives me the times. 上面的用户缓存输出来自APC缓存测试脚本,该脚本试图检索并存储1000个条目并给我时间。 A sort of simple benchmark. 一种简单的基准。

Can anyone help me here. 有人能帮我一下吗。
Even though apc.cache_by_default = 1, no php files are being cached. 即使apc.cache_by_default = 1,也没有缓存php文件。

This is my apc config 这是我的apc配置

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   
apc.gc_ttl  3600  
apc.include_once_override   0  
apc.lazy_classes    0  
apc.lazy_functions  0  
apc.max_file_size   1M  
apc.mmap_file_mask    
apc.num_files_hint  1000  
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    32M  
apc.slam_defense    1  
apc.stat    1  
apc.stat_ctime  0  
apc.ttl 0  
apc.use_request_time    1  
apc.user_entries_hint   4096    
apc.user_ttl    0    
apc.write_lock  1

Also most php files are under 20KB, thus, apc.max_file_size = 1M is not the cause. 大多数php文件都在20KB以下,因此,apc.max_file_size = 1M不是原因。

I've tried following things with no luck. 我试过没有运气的事情。

  1. Using 'apc_compile_file ' to force some files into opcode cache with no luck. 使用'apc_compile_file'强制某些文件进入操作码缓存而没有运气。
  2. re-installed APC with Debugging enabled, but nothing shows in the error_log 在启用调试的情况下重新安装了APC,但error_log中没有显示任何内容
  3. setting mmap_file_mask to /dev/zero and /tmp/apc.xxxxxx, i have also set /tmp permissions to 777 to no avail 将mmap_file_mask设置为/ dev / zero和/tmp/apc.xxxxxx,我还将/ tmp权限设置为777无效
  4. set apc.enable_cli = 1 AND run a script from cli 设置apc.enable_cli = 1并从cli运行脚本
  5. Set apc.max_file_size = 5M (just in case) 设置apc.max_file_size = 5M(以防万一)
  6. switched php handler from dso to FastCGI in WHM (then switched it back to dso as it did not solve the problem) 在WHM中将dso的php处理程序切换到FastCGI(然后将其切换回dso,因为它没有解决问题)
  7. Even tried restarting the container 甚至尝试重新启动容器

Any clue anyone. 任何人都有任何线索。

Note: I had posted the question on serverfault.com but did not get much views or an answer so I'm posting here (as stackoverflow seems to be more active and I have only got 1 month to test my VPS and see if it is of any use over shared) 注意:我在serverfault.com上发布了这个问题,但没有得到太多的观点或答案所以我在这里发帖(因为stackoverflow似乎更活跃,我只有1个月来测试我的VPS,看看它是不是任何超过共享的用途)

It seems the problem was with SourceGuardian. 似乎问题出在SourceGuardian上。
File caching is now working fine after commenting out extension="ixed.5.3.lin" from php.ini. 从php.ini中注释掉extension =“ixed.5.3.lin”后,文件缓存现在正常工作。

It was found out by the Support at my hosting provider, so a thumbs up to such great support. 它是由我的托管服务提供商的支持人员发现的,因此赞成如此强大的支持。 I wouldn't have found the issue for days. 我好几天都没有找到这个问题。

Thought should post the answer in case someone else stumbles over this problem. 思想应该发布答案,万一其他人偶然发现这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM