Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm having trouble with my APC config. It seems like APC caches files with the same name, in different directories, as if they were the same file.

The directory structure is as follows:

src/
  development/
  edge/
  stable/
    tag-20101101/
    tag-20101115/
    ...

The code resides in development, edge and in each of the tag directories. What seems to happen is that when APC caches for example src/stable/foo/bar/quux.php, it uses the same cache for src/development/foo/bar/quux.php, even though they're not the same file. Some files may be included using a relative path, though I have not yet determined if there is any connection between files included relatively, and the APC caching problems.

My APC config (as reported by apc.php) is as follows:

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             5M
apc.mmap_file_mask            /tmp/apc.tKRzKb
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.shm_segments              1
apc.shm_size                  128
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

I am using PHP 5.3.2, and APC 3.1.3p1, with PHP-FPM. The server is a virtualized RHEL 5.4 with 4GB of allocated RAM, running on another RHEL 5.4 server with 32 GB RAM and 12 AMD Opteron 2.4 GHz CPU cores.

Does anyone have any idea what could cause this, or anything I might do to fix it?

share|improve this question

2 Answers 2

according to the docs the paths can be canonicalized when in no stat mode.

http://php.net/manual/en/apc.configuration.php

I interpret that as it may work if you change apc.stat to 0 in the above configuration.

//John

share|improve this answer
    
Yes, however, apc.stat = 1 means that it's in stat mode, not in no stat mode. –  Magnus Nordlander Jan 31 '11 at 20:34

Turned out that the problem wasn't due to APC, but because the NFS3 NAS hosting the code was mounted as NFS4. This caused an issue with filesystem caching. Using APC to an extent masked the actual issue.

Thanks for your time, though.

share|improve this answer

Your Answer

 
discard

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.