[PLUG] system call in php

Richard Steffens rsteff at attbi.com
Fri May 17 02:46:39 UTC 2002


I have the following line in a php file:

system("/usr/bin/mpg123 $fileList &");

$fileList is the name of the selected option in a select box that lists
all the .mp3 files in a particular directory.

This does what I expect it to do, mostly. The php file is on the Linux
machine in my office. The output of that machine's sound card is
connected to the stereo in the living room. Using a laptop in the living
room, I connect to the php file on the machine in the office and
successfully start music file playing with mpg123. That's the part works
the way I expect it to.

With the "&" after the "mpg123 $fileList" I expect the php file to
complete loading. It doesn't. I thought that the "&" was the thing to
use to have a process start up "in the background" and let you continue
doing other things. This does work if I run mpg123 from the command
line. Is there something I should be doing differently with php to get
the same effect?

Also, is there a way for php to receive information about what the pid
is for the process it just caused to be launched? I'd like to build in a
way to stop the music other than logging in, su'ing, running ps -ax, and
then killing the process.

Thanks in advance.

-- 
Regards,

Dick Steffens
"Quando Omni Flunkus Moritati"
http://rsteff.home.attbi.com/




More information about the PLUG mailing list