cmd - php -> shell_exec() -> psexec -> my executable chain fails
I have aphp
from where I have to call acmd
, and from that cmd I have to start an exe usingpsexec
. Myphp
,cmd
,psexec.exe
and theexe
I actually need to run are in the same folder.
php:
shell_exec("runas.cmd");
runas.cmd:
@echo off
psexec -u userName -p password my.exe
If I run thephp
I can see in the task manager thatPSexex.exe
is stared butmy.exe
is not. Also if I runrunas.cmd
by double-clicking on it, everything is just fine.
Answer
Solution:
add 2>&1 after the command and print shell_exec response to see whats actually happen