Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

So firstly I got the PHP 5.3 compiled in as a DSO (apache module).

Then installed APC via PECL through SSH. (First I tried with WHM Module installer, it also had the same problem, so I tried it via ssh)

All seemed fine and phpinfo showed apc loaded and enabled.

Then I checked with apc.php. All seemed OK

But as I started testing my php application, the stats in apc for File Cache Information state: 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. 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

Its actually from an APC caching test script which tries to retrieve and store 1000 entries and gives me the times. A sort of simple benchmark.

Can anyone help me here.
Even though apc.cache_by_default = 1, no php files are being cached.

This is my apc config
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.gc_ttl 3600
apc.include_once_override 0
apc.lazy_classes 0
apc.lazy_functions 0
apc.max_file_size 1M
apc.num_files_hint 1000
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.

I have also tried using 'apc_compile_file ' to force some files into opcode cache with no luck. I have also re-installed APC with Debugging enabled, but nothing shows in the error_log

I have also tried setting mmap_file_mask to /dev/zero and /tmp/apc.xxxxxx, i have also set /tmp permissions to 777 to no avail

Any clue anyone.

Update: I have tried following things and none cause APC file cache to populate
1. set apc.enable_cli = 1 AND run a script from cli
2. Set apc.max_file_size = 5M (just in case)
3. switched php handler from dso to FastCGI in WHM (then switched it back to dso as it did not solve the problem)
4. Even tried restarting the container

share|improve this question

closed as off-topic by Falcon Momot, Ward, cole, mdpc, Ladadadada Oct 23 '13 at 11:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Falcon Momot, Ward, cole, mdpc, Ladadadada
If this question can be reworded to fit the rules in the help center, please edit the question.

If the APC test script is running via the command line, try setting apc.enable_cli 1 – xofer Sep 6 '11 at 18:42
The test script is running from web. But I have also tried setting apc.enable_cli to 1 AND running a script from command line to no avail, still no file caching. – danishgoel Sep 6 '11 at 19:15
apc.ttl 0 You try change this to other value. 0 means no cache Example: apc.ttl 21600 (for 6h) – user195638 Oct 20 '13 at 11:29
This is off-topic? Really??? This is a perfectly valid question pertinent to production systems that deal with an incompatibility between APC and SourceGuardian (as was identified after hours of diagnostics) – danishgoel Feb 17 '14 at 20:19
up vote 1 down vote accepted

It seems the problem was with SourceGuardian.
File caching is now working fine after commenting out extension="ixed.5.3.lin" from php.ini.

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.

share|improve this answer

protected by Tom O'Connor Oct 20 '13 at 13:51

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.