Question

I'm using APC to cache user variables (with the apc_store/apc_fetch commands). I've also enabled APC for the CLI with the option "apc.enable_cli = 1". However, the CLI version of PHP seems to access a different APC cache from the version used by Apache.

Is it possible to configure APC to use the same cache for both CLI and web invocations?

Was it helpful?

Solution

Not possible.. The only way to accomplish something like what your asking is to use something like memcacheD. Or run what you need to run through your webserver. What's running CLI that you cannot run via a web script with a cronjob?

OTHER TIPS

You can use shm. This technology lend to access to Unix Shared memory. You can put some variable in shm and then in another scritp, even programmed in another languaje you can get the shared variables.

shm_put_var and shm_get_var.

It's slower than APC, but it's faster than memcached, redis, etc.

I hope It will help you, and I'm sorry for my English....

call your CLI as a CGI /path-to/cgi-sys/php5.cgi /home/name/crons/engine.php

you would need a web server written in php -- the APC cache is shared only by forked child processes. If you had a php webserver, you could start a master cli, init apc, fork and load/run the web server in one child process, and fork and run your php cli script in another. Kind of a gross hack, huh. Fork and require(), I don't think the apc cache would survive an exec()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top