When using the php-apcu (https://github.com/krakjoe/apcu) extension (not apc) in a php CGI environment the stored data fromapc_store
are empty.
Anyone has experiences on how to solve this issue?
Example PHP File: test-apc.php
<?php
$k = 'test';
if(isset($_GET['get'])) {
$result = apc_fetch($k);
echo "Read entry '$k': $result";
} else if(isset($_GET['clear'])) {
echo "Clear entry '$k'";
apc_clear_cache('user');
} else {
apc_store($k, "HelloWord");
echo "Write entry '$k' set";
}
print_r(apc_cache_info('user'));
?>
Steps to reproduce:
http://server/test-apc.php
to call apc_store
http://server/test-apc.php?get
to receive stored data using apc_fetch
BTW: apc_cache_info('user') shows it properly with first request, second is empty
Relevant packages (OS: Debian 3.2.63):
The module php-apcu is not fully compatible with CGI/fcgid.
Possible reason: CGI/fcgid executes the php interpreter as a new instance on every HTTP REQUEST. So apcu/apc cannot recover the user caches.
The module mod-fastcgi (non-free package for Debian) together with php5-fpm can provide remedy. Its uses a different technique to manage processes.
http://php-fpm.org/wiki/ (down atm - 2015-09-02)