Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would apc_store() return false?

Tags:

php

apc

The documentation on php.net is very spotty about causes of failure for APC writes. What kind of scenarios would cause a call to apc_store() to fail?

There's plenty of disk space available, and the failures are spotty. Sometimes the store operation will succeed and sometimes it'll fail.

like image 702
jodonnell Avatar asked Nov 03 '09 20:11

jodonnell


3 Answers

For php cli it needs to be enabled with another option: apc.enable_cli=On

In my situation it was working when running from a webbrowser, but not when executing the same stuff with php cli.

like image 143
Kees van Dieren Avatar answered Nov 20 '22 14:11

Kees van Dieren


I had exactly the same situation.

I migrated my code from using Cron Jobs, to using Gearman Workers, which were managed through supervisord.

Everything Broke. I couldn't ever get caches to work through APC, and had to revert back to using filebase caching.

Eventually I figured out that when I was using cron jobs, I would load each page via wget, rather than command line. This difference, meant that supervisord, which would load my PHP scripts via command line, wouldn't work, because by default APC will not work through command line.

The fix....

apc.enable_cli=On

like image 26
Layke Avatar answered Nov 20 '22 16:11

Layke


out of memory (allocated memory for apc, that is)

like image 6
Nir Levy Avatar answered Nov 20 '22 15:11

Nir Levy