billy_howard
asked on
Running VLC with PHP exec function.
Hi all,
I am trying to launch VLC from the command line via PHP if that makes sense.
In command line I can do this:
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe " C:\test.avi --fullscreen
And this will launch VLC in full screen mode with the text.avi video ready for my viewing!
Now When I do this with PHP it fails - miserably.
I've attached my current code and as you can see I have tried a few things but it's getting frustrating now! I even tried putting this into a .bat file and executing that. When I had "mkdir c:\test\moo" in the bat file - this worked and created the file okay. but when having: "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe " C:\test.avi --fullscreen in the bat file it failed. PHP seems to try as the page just waiting.
If I launch the bat file normally it all works fine - so it's almost like php cant launch it if it's a visual app or something..
Any help would be great!!
Thanks
Billy
I am trying to launch VLC from the command line via PHP if that makes sense.
In command line I can do this:
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
And this will launch VLC in full screen mode with the text.avi video ready for my viewing!
Now When I do this with PHP it fails - miserably.
I've attached my current code and as you can see I have tried a few things but it's getting frustrating now! I even tried putting this into a .bat file and executing that. When I had "mkdir c:\test\moo" in the bat file - this worked and created the file okay. but when having: "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
If I launch the bat file normally it all works fine - so it's almost like php cant launch it if it's a visual app or something..
Any help would be great!!
Thanks
Billy
$vlcdir = "\"C:\Program Files (x86)\VideoLAN\VLC\\vlc.exe\"";
$moviedir = "C:\test.avi";
//$command = $vlcdir." ".$moviedir." --fullscreen";
//$command = "C:\\test\\test.bat";
//$command = "\"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\" C:\test.avi";
$command = "\"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\"";
var_dump($command);
//exec($command);
shell_exec($command);
ASKER
Just add I have (or atleast belive I have) added "iusr" and "everyone" full access to windows\system32\cmd.exe
ASKER
I do yes,
I'm running apache locally.
I'm running apache locally.
ASKER
I have looked at that page. and I have managed to get things to execute but nothing thats gui really. for example usally when a bat runs you see a quick command line window come and go. you dont even get that when the bat file was working! when it comes to launching applications that you want to see it just seems to fail!
Thanks
Billy
Thanks
Billy
ASKER
Just to add some more information. I just run this from command line and it launched okay. but when using with a web browser it fails.
In the web services for Apache, give it the ability to interact with the desktop:
Start --> Run --> services.msc
Right-click the Apache service and choose Properties.
Go to the Log On tab, and check the box "Allow service to interact with desktop"
Restart Apache for good measure and try your script again.
Start --> Run --> services.msc
Right-click the Apache service and choose Properties.
Go to the Log On tab, and check the box "Allow service to interact with desktop"
Restart Apache for good measure and try your script again.
ASKER
Hi gr8gonzo.
I have done that with no effect - i think it is something todo with apache though because it does work from command line php.
I changed like you said and tried using exec and then downloaded "psexec" from sysinternals also (as someone reccommended this) and it still failed.
Billy
I have done that with no effect - i think it is something todo with apache though because it does work from command line php.
I changed like you said and tried using exec and then downloaded "psexec" from sysinternals also (as someone reccommended this) and it still failed.
Billy
ASKER
Another update:
I tried setting the service too my username and it seems to launch it but all I get is sound, I cant see the application or video. When I went to end the task it didnt show up (even though it's running as my username now), when I said "show processes from all users" it shows and it did say it was running as my username
Billy
I tried setting the service too my username and it seems to launch it but all I get is sound, I cant see the application or video. When I went to end the task it didnt show up (even though it's running as my username now), when I said "show processes from all users" it shows and it did say it was running as my username
Billy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
on the local machine if you are actaully running a webserver and php then you can use exec.
here is a quick refrence: http://www.chipmunkninja.com/article/phpexecfns