1

CentOS 6.2 PHP APC not holding vars

view story
linux-howto

http://serverfault.com – I have a simple script that tests for holding data using APC by grabbing a variable from the URL and incrementing the "seen" counter with a lifetime of 5 seconds, as follows: <?php if (!isset($_GET['var1'])) { echo "MISSING var1"; exit; } echo "STARTING!\n"; $foo = $_GET['var1']; echo "GOT \$foo: {$foo}\n"; if (apc_exists($foo)) { echo "\$foo EXISTS!\n"; if ($bar = apc_fetch($foo)) { echo "VAR: " . $bar; apc_store($foo,$bar+1,5); } else { echo "WHERE'S \$foo??\n"; } } else { echo "ADDING TO APC\n"; apc_store($foo,1,5); } ?> (HowTos)