Ville Mattila wrote: > How could I use PHP and its process functions to send something to stdin > of a persistent process? I would like to run mpg123 only once, > whichafter a few PHP scripts would send data and proper commands to its > stdin. Maybe a kind of daemon process would be needed? Anyway, sending > data to a daemon can be problematic... Maybe a kind of socket wrapper? > Well - I have no experience about socket functions of PHP... > > Tips and tricks are welcome, or should I just go to the local hi-tech > market and by a CD player LOL :D
I would probably approach this in one of two ways. 1) Find out how to create a named pipe and start mpg123 to take its input from that named pipe. Your PHP scripts can then write commands to that pipe. 2) Write a daemon that starts mpg123 and listens on a local socket. Your PHP scripts send commands to that socket and the daemon passes them to the running mpg123. IMHO option 1 would be a lot more stable than option 2, but both should work quite well. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php