i need to run a web browser (chrome - firefox ..) using exec
i have tried to do it using bat file (this method mentioned here)
C:\Users\farok\AppData\Local\Google\Chrome\Application\chrome.exe www.google.com
when i open the file using windows every thing goes well but nothing happened when i open it using exec
and i have tried to do it using jar file by BrowserControl class
BrowserControl.displayURL("www.google.com");
and the same as bat file happened so is there any way to do it?
note:im using wamp 2.2 ,Apache 2.0 , PHP V5.3.8
Update
i found that after i run this command
exec('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "www.google.com" 2> errors.txt');
firefox dose open in task manager but the browser interface not visible .. any ideas?
I'm no windows expert, but I think you need to allow desktop interaction
, which isn't easy/possible if the parent process runs as a windows service. php runs inside the apache process, which you probably have running as a service.
Try stopping the service and manually starting httpd.exe, and then the following works for me on win7 when i request the script via localhost url through apache. my php interfaces with apache via plain old cgi.
exec('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "http://stackoverflow.com/"');
note my use of quotes.
so this is another good workaround i found here, the idea is to create a scheduler that execute the program you want and call it using command
hope this help :
shell_exec('SCHTASKS /F /Create /TN _notepad /TR "notepad.exe" /SC DAILY /RU INTERACTIVE');
shell_exec('SCHTASKS /RUN /TN "_notepad"');
shell_exec('SCHTASKS /DELETE /TN "_notepad" /F');
I solved that by disabling apache service on windows and start apache with httpd.exe After that can use exec() for open any GUI windows program.
exec("Path_to_mi_program.exe" "file_to_open");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With