Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 installed APC 3.1.5 beta because 3.0.19 gives me some weird error.

3.1.5 is installed fine, it appears on phpinfo and functions work without errors. The only problem is that data is not saved persistantly.

I can do apc_store and apc_fetch inside the same script and on the same instance it will return the stored data fine, but if i use two instance where one stores and the other fetches, the later won't return anything, just like the key doesn't exist.

Also using the apc.php provided i got the following info that may help:

Shared Memory 1 Segment(s) with 32.0 MBytes
(mmap memory, pthread mutex locking) 
Uptime 0 minutes

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.mmap_file_mask /tmp/apc.rSmNYe
apc.num_files_hint 1024
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.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

Installed using pecl on Apache 2.0.63, PHP 5.3.3, nginx 0.8.46, CentOS 5 64bit

Any ideas? Thanks

share|improve this question
Are you using apache or nginx? – Rob Olmos Nov 3 '10 at 21:07
I'm using apache and nginx as a reverse proxy using RPAF and port redirection. – omgirkal Nov 5 '10 at 8:12
up vote 0 down vote accepted

With APC you have to use mod_php or PHP-FPM otherwise a new APC cache is created for every process and your requests may not be served from the same process.

You can see this effect by loading up apc.php (APC stats from the APC package) and see how the cache location changes on every request.

With APC I tend to use mod_php on Apache boxes and PHP-FPM on nginx boxes. If anyone knows of any other methods please let me know. There are no plans for APC to fix because it works fine under PHP-FPM.

share|improve this answer
Very nice response, thanks. I'm using php cgi atm, so it's a good time to move to fastcgi and FPM. – omgirkal Nov 5 '10 at 8:13
Yup. You'll notice a nice speedup by that move alone since PHP itself will not be loading on every request. Disabling APC's file checking can squeeze out some more speed. – Rob Olmos Nov 5 '10 at 9:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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