I am using apc_store and fetch to store data, however after lots of debugging it appears that my store or fetch functions are just not working:
$bar = 'BAR';
apc_store('foo', $bar);
var_dump(apc_fetch('foo'));
Returns
string(3) "BAR"
But if I 开发者_如何学JAVAdo
$new = 'new';
apc_store('test', $new);
And then on the next page
apc_fetch('test')
The value returned is null?
Am I missing something major here?
Thanks,
APC Fetch doesn't work on a GCI system as a new thread is started for each request.
Quote from somewhere
If you setup PHP with FastCGI, you'll probably run into trouble using this function to get any information about a running upload. At least in my case, every HTTP request is handled by a different PHP process. I could track it with the getmypid() function, which returned a different value upon every request, but only from a limited set. Also, apc_cache_info() gave me all upload_* entries that were created in that process. So when the upload was initially catched by one PHP process, all progress updates must be fetched from the same process, too, because APC cache information does not seem to be shared across multiple processes handling that domain/virtual host. But that's impossible to tell because PHP has its own load management and serves every request by an arbitrary process.
So in short: When using FastCGI and multiple PHP processes (recommended for performance reasons), you cannot use APC upload tracking. You'll only get a status update every few requests.
I am using FastCGI so Presume this is the problem? I never even considered it was a hosting issue!
精彩评论