Shared objects between several pages on Apache

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
patoch74
Forum Newbie
Posts: 2
Joined: Tue May 31, 2005 4:29 am

Shared objects between several pages on Apache

Post by patoch74 »

Hello,
I am trying to set up a little game, using php and flash.
I built a "Map" objects where players can run their figure.
Now I would like to have this Map in a global variable / shared objects persistent in memory, to avoid storing all that in a database...
Daoes Anyone has an idea about how to do that ?
Many thanks for your help !
Patrick :?:
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

take a look at classes.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

and read up about http://www.php.net/shmop (shared memory operations)
patoch74
Forum Newbie
Posts: 2
Joined: Tue May 31, 2005 4:29 am

Post by patoch74 »

Thanks for your support !
Actually, in the classes section, I could not find any relevant information concerning this problem.
The shared memory section is interesting, but it seems that you will only be able to use it as a file. In the present case, I would like to store a complete object, which means that I would need to serialize it before storing it in shared memory.
To make it more simple, I wished I could use some global variable ($_ENV for example) to store it or create a "game session" accessible by all user sessions ...
If anyone has a clue ... your guiding is appreciated !
Patrick
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

php doesn't have application/script wide variables...

So you are forced to implement it yourself using shmop/database/file/whatever...
Post Reply