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.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.
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