I'm working on a PHP platform which gives to developers some features like cron jobs, events and WebSocket communications, for do that I run three different daemons written in PHP, so admins can disable a specific feature. When I start them, after fork, the daemon starter saves the PID on my database and then includes the daemon PHP file. I need to allow developers to easily communicate with these daemons using the specific PHP class. I've seen that exist many different methods for communicate with processes, I've seen for example the proc_open function but it looks like must run a new command for communicate with it. I'm looking for something like PHP sockets but which allow me to open the socket to a PID and without using a port (if it's possible) for avoid conflicts with other daemons sockets. Which is the better way for do that with native instruments of PHP?
One more detail: these daemons may be able to manage pretty big load of connections, events are propagated also to clients through WebSocket or AJAX polling so event and WebSocket daemons communicate between them.
Using a process based approach and reusing the same process ( presumed from your explanation ), and communicating with it without using sockets would be difficult. If you are not that bothered about scalability beyond a server, then it would be fine. You will have to at least use a socket (network or unix), then make the process bind and listen on a random port, and save the port number or unix path in the database, along with the PID.
Another (old fashioned option) would be to make use of xinetd; make your daemons started and managed by xinetd. Here you are really rewiring the stdin and stdout using sockets, by out-sourcing it to xinetd daemon.