So I'm intrigued by this, since I haven't been able to find any documentation on it (that leads to anything, that is.)
If I execute a direct command via ssh2_exec which will give me a reply, and I want to then take that reply ($data) and store it in PHP as a session or anything else (echo it, do whatever.) - it will work perfectly.
It will take the received $data from the command - for example (ls | grep Hancock) - and give it to me, works fine.
However, if I am to write a bash script that has this command inside, just the same, and then execute this bash script via ssh2_exec - even though the bash script gives THE EXACT same output, the $data variable is empty O_o
I've tried ./bash.script - sh bash.script - bash bash.script and a few other ways of executing the script, non make any difference.
Any advice? I know this isn't some PHP forum but I thought I might as well write something up real quick and give it a shot before running off to stackoverflow and looking like an idiot (I'm relatively new to PHP)
Executing a normal command is fine for now, but for reasons of complexity I like to do everything via variables passed onto a bash script.
I work for Nodisto.