views:

741

answers:

2

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?

+2  A: 

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?

DreamWerx
.. or more importantly - why do you need that kind of performance optimisation on a cli script?
troelskn
Very true.. web is typically high impact/hits, and CLI one off calls.
DreamWerx
I'm not bothered about APC caching the CLI script. I want to be able to access the same APC user cache from the web and CLI. If it isn't possible I'll just have to call a web script from the CLI and get it to pass in the required data. Not the most elegant solution!
Ben Dowling
A: 

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

ppostma1
Good idea, but this didn't work for me on CentOS (/usr/bin/php-cgi)
ColinM