Jump to content


Photo

process level communication


  • Please log in to reply
No replies to this topic

#1 sneskid

sneskid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 08 June 2006 - 08:23 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users