I create 2 file. First file, set apc var :
<?php
$bar = 'BAR';
apc_store('foo_test', $bar);
echo 'stored';
?>
Second file, try to get apc var :
<?php
var_dump(apc_fetch('foo_test'));
?>
I visited first file, everything is fine. I open second file, i refresh several times, usually (almost 90%), it returns false. And rarely returns correct response.
Here is my APC setting.
apc.cache_by_default 1
apc.canonicalize 1
apc.coredump_unmap 0
apc.enable_cli 1
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 20M
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 512M
apc.slam_defense 1
apc.stat 0
apc.stat_ctime 0
apc.ttl 0
apc.use_request_time 1
apc.user_entries_hint 4096
apc.user_ttl 7200
apc.write_lock 1
My guess is that Litespeed is running PHP with FastCGI. So it's spawning some child processes and then dispatch the requests between them. The problem is that probably APC stores the data in the heap memory (not in the shared memory), so every FastCGI instance has it's own APC data. The data in one instance will not be visible in the other instances. You set the data in instance #1, but then your fetch request goes to instance #2, instance #3... and you get FALSE. When you hit the instance #1, then you'll receive the saved value.
Edit: Compiling the APC module with --disable-apc-mmap
(Disable mmap support and use IPC shm instead) should fix the issue.