I am trying to execute the command exec('vlc');
from php script (in linux),
but then, the page (php) has not been loaded.
Even by using pcntl_fork (for exec command) this is not working.
But if I am trying to run from command line php -S localhost:8000 -t path/to/src,
and enter localhost:8000/page.php in the browser, the page has been loaded and the vlc opened.
What is the problem ?
Note:
If I am trying to run from command line php -r "exec('vlc');" the vlc opened.
In addition, I checked and the php not working in safe mode.
Update1:
<?php
echo shell_exec('vlc');
?>
**** not working ****
<?php
echo shell_exec('vlc 2>&1');
?>
The output:
Home directory not accessible: Permission denied [08ea1490] pulse audio output error: PulseAudio server connection failure: Connection refused [08e9e448] core interface error: no suitable interface module [08ded0d0] core libvlc error: interface "globalhotkeys,none" initialization failed [08e9e448] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11 [08e9e448] core interface error: no suitable interface module [08ded0d0] core libvlc error: interface "dbus,none" initialization failed [08ded0d0] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. [08e9e448] qt4 interface error: Could not connect to X server [08e9e448] skins2 interface error: cannot initialize OSFactory [08e9e448] [cli] lua interface: Listening on host "*console". VLC media player 2.2.0 Weatherwax
<?php
echo shell_exec('whoami');
?>
The output: www-data
/var/log/httpd
not exists
but /var/log/apache2/error.log exists and:
Home directory not accessible: Permission denied
[0980c490] pulse audio output error: PulseAudio server connection failure: Connection refused
[09809448] core interface error: no suitable interface module
[097580d0] core libvlc error: interface "globalhotkeys,none" initialization failed
[09809448] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[09809448] core interface error: no suitable interface module
[097580d0] core libvlc error: interface "dbus,none" initialization failed
[097580d0] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[09809448] qt4 interface error: Could not connect to X server
[09809448] skins2 interface error: cannot initialize OSFactory
[09809448] [cli] lua interface: Listening on host "*console".
[09809448] [cli] lua interface: Requested shutdown.
Update2:
shell_exec("DISPLAY=:0 vlc");
working, but very slowly (with php -S ... , is faster).
I trying
shell_exec("DISPLAY=:0 vlc v4l2:///dev/video0 --sout '.settings.'");
(with some settings) but I received an error
[b4602c50] mux_ogg mux: Open
[b4604a30] v4l2 demux error: cannot open device '/dev/video0': Permission denied
[b4604a30] v4l2 demux error: cannot open device '/dev/video0': Permission denied
[b4604a30] v4l2 access error: cannot open device '/dev/video0': Permission denied
[b4b04ea0] core input error: open of `v4l2:///dev/video0' failed
[b4b04ea0] core input error: Your input can't be opened
[b4b04ea0] core input error: VLC is unable to open the MRL 'v4l2:///dev/video0'. Check the log for details.
[b4602c50] mux_ogg mux: Close
but with php -S ... is working .
What is the problem ?
Thanks in advance