Jump to content

process level communication


sneskid

Recommended Posts

I'm interested in having PHP processes communicate and share resources (for example a DB connection).

I've done some testing and it seems that even persistent DB connections are created on a per-process-basis (even if simultaniously running PHP processes are accessing the same DB with the same credentials).
I say this because in my test the connection resource IDs were different... but then again they may reference the same connection behind the scenes. I have no way of knowing for sure, it would be nice if it were clerified.


Here is an example of what I'd like to achieve:
{
- Start 1 PHP script that will create and keep alive a database connection, a "master" script. It may even have a registry system. It may even check if an instance of itself is already running, so it will not run again. It's mainly for sharing DB connection, and communication among mini-php-processes (ex. from clients visiting the web page).

- As people use the website, they will ofcourse spawn php processes. These processes will check for the master script and use it, in essence, as a portal. They can share data and common resources that don't need to be duplicated (like a database connection).
}

I'm aware there are security issues, testing nightmares and who knows what else at risk with this model. But I'd like to know my options when it comes to php process-level communication.

I've read the singleton patter, I've read the registry pattern, they only help in the current process. They aren't truely global. (atleast in the context of the article I was shown)


Thank you in advance for any advice, prayers, references & clerification.
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.

Guest
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.