Page 1 of 1

Memory sharing?

Posted: Wed Sep 20, 2006 12:20 am
by Skeptical
In PHP is there such a thing as memory sharing, so that all PHP processes have access to objects/values stored in the main memory area (if there's such a thing in PHP)?

I'm asking this because there's a conf file my application will include. However, I think it's a waste of resources if every single PHP script call requires this file to be opened, read, and closed. It'd be more efficient if it is included once, stored in memory, and fetched by all relevent PHP scripts when requested.

Posted: Wed Sep 20, 2006 12:28 am
by Luke
I don't think so... including all necessary files for every request is pretty much how it's done

Posted: Wed Sep 20, 2006 3:05 am
by volka
There are shared memory functions, see http://de2.php.net/manual/en/ref.sem.php
But you would have to code the behaviour for all scripts yourself. That's not worthwhile.
Maybe some kind of cache (holding the parsed scripts as needed in memory) is more suitable for you, see http://us2.php.net/apc and http://www.zend.com/products/zend_platform