When i execute following none works (checked with ps aux | grep mplayer, where 1.wav is a 10 minutes audio file):
system("mplayer /tmp/1.wav"); // failed
system("sudo -u myusername mplayer /tmp/1.wav"); // failed
system("mplayer /tmp/1.wav &"); // failed
system("(mplayer /tmp/demo.wav) >/dev/null &"); //failed according to: http://www.php.net/manual/fr/function.system.php#88543
system("sudo -u myusername -i mplayer /tmp/demo.wav");
How can i run a background process with PHP? Only this works but its like batch file and i am in the same system. $ php -r "system('mplayer /tmp/demo.wav');";
Thank you
Note: 1) error:
Cannot find HOME directory.
Home directory /var/www not ours.
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
Home directory /var/www not ours.
waitpid(): No child processes
[AO_ALSA] alsa-lib: pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Internal error
[AO_ALSA] Playback open error: Connection refused
Failed to initialize audio driver 'alsa'
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
Home directory /var/www not ours.
waitpid(): No child processes
[AO_ALSA] alsa-lib: pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Internal error
[AO_ALSA] Playback open error: Connection refused
Home directory /var/www not ours.
AO: [pulse] Init failed: Connection refused
Home directory /var/www not ours.
waitpid(): No child processes
Home directory /var/www not ours.
[AO_ALSA] alsa-lib: pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Connection refused
Aborting. $HOME not set!
2) & 5) error:
sudo: sorry, you must have a tty to run sudo
3) error:
Cannot find HOME directory.
File not found: '/tmp/1.wav'
Failed to open /tmp/1.wav.
4) error:
Cannot find HOME directory.
Home directory /var/www not ours.
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
Home directory /var/www not ours.
waitpid(): No child processes
[AO_ALSA] alsa-lib: pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Internal error
[AO_ALSA] Playback open error: Connection refused
Failed to initialize audio driver 'alsa'
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
Home directory /var/www not ours.
waitpid(): No child processes
[AO_ALSA] alsa-lib: pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Internal error
[AO_ALSA] Playback open error: Connection refused
Home directory /var/www not ours.
waitpid(): No child processes
AO: [pulse] Init failed: Internal error
Home directory /var/www not ours.
waitpid(): No child processes
Home directory /var/www not ours.
waitpid(): No child processes
[AO_ALSA] alsa-lib: pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Internal error
Aborting. $HOME not set!