Goal: To launch VLC player through PHP code, and play the specified video in the player.
OS: Ubuntu 11.10
Problem: Please refer my script below (still new to PHP), I see no video playing, and not even a background VLC process running on executing this script. Can you please point out the issue and appropriate documentation that will help me make this work? If I issue the same command on shell, the video plays, but on using “system” command of PHP, no video plays.
Script:
<?php
system('/usr/bin/vlc /home/atish/Videos/TEDGary.avi', $retval);
echo $retval;
?>
Output on the webpage:
0
Bigger goal: I want provide a webinterface for the user to run my application (C-code). My c-code application that implements some video transcoding and management workflows, I want to be able to run that C code in background, and when it finishes, I want to play the video in VLC.
Thankyou.
Allow everyone to use the X server:
In your script, set the DISPLAY variable when executing the command:
However, I’d also recommend you to consider the security implications when using xhost.