Not a bug "Fetch public templates as files" option prevents template changes working, maybe just with APC

Mick West

Well-known member
Setup:

XF 1.1.5
"Fetch public templates as files" enabled
permission on data, internal_data and sub folders at 777
APC installed.
apc.shm_size=256M

Steps to reproduce:

  1. Enable "Fetch public templates as files"
  2. View /forum (or any similar public page) to get things cached
  3. Edit the navigation template to add some random text (just add, say "XXX" to the second line)
  4. Refresh the page in step 2, note text is not there.
  5. Flush the APC cache (using apc-stats.php, "clear opcode cache")
  6. Refresh the page in step 2, note text appears
  7. Repeat with "Fetch public templates as files" disabled, note changes work as expected (might need an initial cache flush)
This is regardless of the $config['cache']['backend'] setting, which I have either as:

$config['cache']['backend'] = 'Apc';

or nothing, and the problem occurs either way.

APC config file in /etc/php5/conf.d/apc.ini

Code:
extension=apc.so
;apc.enabled=1
;apc.shm_segments=1

; Really should be fine with 128M, saw peak of 75M
apc.shm_size=256M
; ttl of 0 makes it more robust
; however it will flush the entire cache when full
; with a large cache this will be infrequently
apc.ttl=0
apc.user_ttl=0
apc.filters=apc\.php$
;;;;;;;;;;;;;;;;;;;;;;;;;
// From:
http://xenforo.com/community/threads/cache-pages-with-apc-mysql.36766/
; Enable apc extension module
//extension = apc.so
; Options for the APC module version >= 3.1.3
; This can be set to 0 to disable APC.
apc.enabled=1
; The number of shared memory segments to allocate for the compiler cache.
apc.shm_segments=1
; The size of each shared memory segment in MB.
apc.shm_size=256
; A "hint" about the number of distinct source files that will be included or
; requested on your web server. Set to zero or omit if you're not sure;
apc.num_files_hint=1024
; Just like num_files_hint, a "hint" about the number of distinct user cache
; variables to store. Set to zero or omit if you're not sure;
apc.user_entries_hint=4096
; The number of seconds a cache entry is allowed to idle in a slot in case this
; cache entry slot is needed by another entry.
apc.ttl=7200
; use the SAPI request start time for TTL
apc.use_request_time=1
; The number of seconds a user cache entry is allowed to idle in a slot in case
; this cache entry slot is needed by another entry.
apc.user_ttl=7200
; The number of seconds that a cache entry may remain on the garbage-collection list.
apc.gc_ttl=3600
; On by default, but can be set to off and used in conjunction with positive
; apc.filters so that files are only cached if matched by a positive filter.
apc.cache_by_default=1
; A comma-separated list of POSIX extended regular expressions.
apc.filters
; The mktemp-style file_mask to pass to the mmap module
apc.mmap_file_mask=/tmp/apc.XXXXXX
; This file_update_protection setting puts a delay on caching brand new files.
apc.file_update_protection=2
; Setting this enables APC for the CLI version of PHP (Mostly for testing and debugging).
apc.enable_cli=0
; Prevents large files from being cached
apc.max_file_size=5M
; Whether to stat the main script file and the fullpath includes.
apc.stat=1
; Vertification with ctime will avoid problems caused by programs such as svn or rsync by making
; sure inodes havn't changed since the last stat. APC will normally only check mtime.
apc.stat_ctime=0
; Whether to canonicalize paths in stat=0 mode or fall back to stat behaviour
apc.canonicalize=0
; With write_lock enabled, only one process at a time will try to compile an
; uncached script while the other processes will run uncached
apc.write_lock=1
; Logs any scripts that were automatically excluded from being cached due to early/late binding issues.
apc.report_autofilter=0
; RFC1867 File Upload Progress hook handler
apc.rfc1867=0
apc.rfc1867_prefix =upload_
apc.rfc1867_name=APC_UPLOAD_PROGRESS
apc.rfc1867_freq=0
apc.rfc1867_ttl=3600
; Optimize include_once and require_once calls and avoid the expensive system calls used.
apc.include_once_override=0
apc.lazy_classes=00
apc.lazy_functions=0
; not documented
apc.coredump_unmap=0
apc.file_md5=0
apc.preload_path
// Other advice:
apc.stat=0
// Cache files in memory....
apc.mmap_file_mask=/apc.shm.XXXXXX
 
You have apc.stat=0 at the very end. This means that APC won't check for file updates before using the cached values (which is faster). As such, this would be the expected behavior (it'd be the same if you uploaded an updated PHP file).
 
Back
Top Bottom