Memory sharing?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
Skeptical
Forum Newbie
Posts: 8
Joined: Mon Sep 18, 2006 10:23 pm

Memory sharing?

Post 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.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I don't think so... including all necessary files for every request is pretty much how it's done
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
Post Reply