function soundOut($message) { global $mp3p, $playing, $process; $descriptorspec = array( 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout 2 => array("pipe", "w") // stderr ); $command = $mp3p." $path/messages/".$message; if (!$playing) { $process = proc_open($command, $descriptorspec, $pipes); $playing = true; } $status = proc_get_status($process); echo $status['pid']; usleep(100000); //exec('kill '.$status['pid'].' 2>/dev/null >&- >/dev/null'); if (!$status['running']) { proc_close($process); $playing = false; } }