Jump to content

Permanent data in php


Recommended Posts

Exist in php a way to load or execute a thing only when you start the server and anything more? Because using sessions for example, you can check if exist, but thas too bugy and also exist a sesion for each user, so if i want  a permament array of errors, for example, for each conection it will be created that array and some other things, and i want to have all the errors in one...


Link to comment
Share on other sites

Thats a way but... my problem is also that i was looking to instantiate some complex object that can have lots of data only a time in the server, and be accesed permantley, so you dont waste resources recreating that object.


Link to comment
Share on other sites

So you want to store an object permanently in memory?


I don't think this is possible.


From what I've read, even trying to keep a class in a static state through multiple page requests (via serialize+session, or other means) can cause serious debugging headaches, and is quite slow.

Link to comment
Share on other sites

shared memory blocks should be pretty sufficient, I've used them a while back they were pretty nifty, but they're pretty hard to work with.. and could be simplified by simply piping php files together..




but for what YOU want, you'd probably want shared memory blocks, but honestly you're going to have to establish a lock to access data in the shared memory blocks, and also you're blocking data away from the rest of your server, for things you could simply use a text file for..


Your best bet in any event (take it from us, here at phpfreaks) a text file is one of the better options for simple text storage, databases for indexed text storage, I mean, there isobviously a good reason these were created.. and you only sacrifice a fraction of a second to establish any resources associated with file handling, database handling is similarly costless, but text files are very fast.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.