Hello Friend, i heard this same questions in other thread, i am sharing the same information because the question you asked is similar as the earlier question..
I have WAMP setup and I need to execute a program.
Right now I'm failing on all my attempts.
I have tried...
also opening a batch file and Python script that executes the program and I have no luck for now.
I have been digging for couple of days and I can't find a solution for this problem.
$test = shell_exec('F:\batch.bat');
$test = system('F:\batch.bat');
$test = exec('F:\batch.bat',$output,$return);
$test = popen('F:\batch.bat','r');
Start, cmd /c, cmd /d, don't work the way I want. Actually day don't execute the program. They just open a second cmd outside or inside the parent cmd.
When I execute internal program... let us say "notepad" I can see in my task manager and Process Explorer that it is opening the "notepad" but it looks like a child process for Apache and it's not showing up on the screen.
Is Apache running as a service? My guess is yes, and what is happening is Apache is launching under a different session/user than the one you are logged in as. Thus the window isn't visible to you. Unfortunately I'm not sure exactly how to fix that besides not running Apache as a service.
After you point me to the problem I went for investigation. So actually the problem is that any program that had to be run from php/apache it executes in different session and even if the user is the same I think it can't find the same session.
The other difference that I notice is any program executed by cmd or explorer.exe are executed also as NT AUTHORITY\INTERACTIVE and any program from PHP/Apache is executed as NT AUTHORITY\SYSTEM.
So some may ask so what... well it is not INTERACTIVE so I went to look for a way to start program in INTERACTIVE Authority and there was a Micro$oft Solution for that and it is called PsTools and their psexec.exe tool.
The right command is:
path/to/psexec.exe -i -s path/to/your/file.exe
For now I think it is working. I will give it a better test to see if I can actually use it.
Hope this can help you, if this will be helpful to you, please share your experience here. Best of Luck