Is there something I'm missing in the documentation that allows for me to share a variable across scripts.

ie. similar to a session but can be accessed by all users.

I'm looking for a quick solution, would rather not use persistent storage for this.

Cheers

    Hi,

    You could possible have a php file in which you define superglobal(s), and include it into all the file you wish to have access to that global.

      thanks, but they need to be able to be changed by one script and thus the change be seen by the other scripts. There will be lots of vars and frequent changes but nothing will remain for longer than a few mins... hence i don't want persistent storage but i think it might be my only choice.

        Possibly you could use the shared memory functions. Or if you are not using separate sessions for individual users, perhaps you could use the [man]session_id/man function to set a "hard coded" session ID for all users, so that they would share the same session data. However, I'm not sure how locking (if any) works on the session data files, so I cannot unconditionally recommend this without further research.

          Write a Reply...