I have a problem running a command from a PHP
script. The command I am trying to run is
echo y | plink -ssh -N -D 9999 admin@1.2.3.4 -pw admin -v
The thing is that the command runs but the script freezes until the execution of plink
command, which I don't want. I also tried (running in background) this :
START /MIN "cmd.exe" /C "plink -ssh -N -D 9999 admin@1.2.3.4 -pw admin"
and I see minimized plink
running, and as soon as I close it, the script continues.
I also tried:
START /B /MIN "cmd.exe" /C "plink -ssh -N -D 9999 admin@1.2.3.4 -pw admin"
and it does the same thing, but is showing the output in the PHP script.
this is the function :
function create_tunnel($ip,$user,$pass,$port)
{
exec('START /min cmd /c "echo y | plink -ssh -N -D '.$port.' '.$user.'@'.$ip.' -pw '.$pass.' -v" > nul');
}
What must I do to run this command and let the PHP script continue execution? In linux this would be very simple, I would just use screen
command.
Thanks.