问题
i have apc.enable_cli=1
in php.ini for cli;
i tested sharing variables with apc with this script:
<?php
$apctest=apc_fetch('apctest');
echo "apctest was " . $apctest;
echo "\n";
if($argc>1){
$newval=$argv[1];
}else{
$newval='ok';
}
echo "setting apctest to " . $newval;
echo "\n";
apc_store('apctest',$newval);
sleep(30);
i runned it with
php test_cli_apc.php > /dev/null &
and then within 30 seconds runned
php test_cli_apc.php
but it has outputted "apctest was " , not "apctest was ok"
i have tried same script with "apc" changed to "apcu" but it also does not work in same way.
来源:https://stackoverflow.com/questions/45129579/how-to-get-php-cli-processes-share-variables-via-apc