I am working on a phpwebsocket application. I have to store the instance of the phpwebsocket every where in my app. I found a solution, that beeing with APC. And it doesn’t work.
The problem is that if I acces a file with apc_store(‘foo’, ‘bar’) from a script php that I run on php console, it won’t work. If I do a http request (using a browser.. ) it actually works, but I realy have to run the phpwebsocket from php console.
In php.ini :
[APC]
extension=php_apc.dll
apc.enabled = 1
apc.enable_cli = 1
apc.shm_segments = 1
apc.shm_size = 64M
apc.max_file_size = 10M
apc.stat = 1
Thanks.
APC collects and stores cache within its process space. Since console apps start a new process every time, APC cache starts clean and therefore there is no performance gain.
In case of apache mod, the process space is apache web server itself which stays alive.
1) how about doing a
wget URLon console instead of a standalone console php script? If you need output, usewget -O - URL. APC will work just fine. The restriction here is script does not get any physical file access.2)You could do a file_get_contents(URL) from within your console php console script and dump the contents. That way, you can call it from console and even have the advantage of shared APC cache. You also get physical file access here but there is one problem. URL fetching as files are OFF by default for serious security reasons. You may need to turn it ON in php.ini. Carefully verify your case before using it on production network.
http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen