APC - problems with CLI & odd return values from apc_clear_cache()
| From: | Jochem Maas | Date: | Fri, 28 Jul 2006 11:13:50 +0000 |
| Subject: | APC - problems with CLI & odd return values from apc_clear_cache() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-239849@lists.php.net to get a copy of this message | ||
hi people,
PHP version: 5.1.1 (last built: Dec 28 2005 16:03:22)
APC version: 3.8.10
Apache version: 2.0.54 (last built: Dec 29 2005 14:04:16)
OS: debian
I have a script that runs via the cmdline, it's used to import/update data
in a database, after the script is run the APC cache needs to be cleared so that
that the new/updated data is visible on the website. to do this I call a static
method of my cache management class which effectively performs the following:
apc_clear_cache();
apc_clear_cache("user");
this used to work, but now it does not (atleast not on the cmdline; calling the
above mentioned method via a webrequest still works). I have not recently updated
php, apc or apache, neither have made any changes to the php.ini configuration.
someone else may have updated the OS/system (and I can't rule out that .
to test the problem I ran the following code at the cmdline:
# php -r 'var_dump( ini_get("apc.enable_cli"),
apc_clear_cache(),
apc_clear_cache("user") );'
this is the output I get:
string(1) "1"
NULL
bool(true)
so apc is enabled for the cli, cache clearance seems to work but when I checking the output
of the apc.php file (shipped with the apc package) I see that nothing has been cleared; performing
the same apc_clear_cache() calls (by way of pressing the buttons on the page output by apc.php) via
the webserver module *does* clear the cache.
it seems all of a sudden that the CLI and then apache SAPI are looking at different caches -
running apc_cache_info() && apc_sma_info() on the commandline show nothing in the cache
whereas
viewing the stats produced by apc.php (via the webserver) shows plenty of stuff in the cache (both
before and after running apc_cache_info() && apc_sma_info() on the commandline)
can anyone offer some help/idea/etc?
Another Thing:
===========================================================================
although the manual states that apc_clear_cache() should always return a boolean
calling it calling the function without any args *always* returns NULL. can anyone say whether
this is a bug or a documentation problem?
My APC ini settings (as defined in a seperate apc.ini):
===========================================================================
; Enable APC extension module
extension = apc.so
[APC]
apc.enabled = 1
apc.shm_segments = 2
apc.shm_size = 128
apc.optimization = 0
apc.num_files_hint = 2000 ; ?
apc.ttl = 180
apc.gc_ttl = 0
apc.slam_defense = 0
apc.file_update_protection = 0 ; 1
apc.cache_by_default = 1
apc.enable_cli = 1
apc.filters = -.*\.class\.php
; +\.tpl\.php,+.*\.interface\.php,+.*\.funcs\.php
; +.*\.class\.php
;apc.max_file_size = 8M
apc.user_entries_hint = 0
apc.user_ttl = 0
; this fixes a bug that causes $_SERVER not to be defined on 2nd/subsequent requests
auto_globals_jit = Off