0

I checked some pages here (e.g: How can I use PHP to setup an interactive SSH session? ) php.net/ssh2 i know ..

but no where i found an answer about the problems opening a remote shell (eg: bash) to do stuff at the remote side, closing it an the php script go's on.

php exec('ssh user@server "bash -i -l", $bufferList) works but the output goes to the local buffer.

closing the remote connection and i can work with the output (after/post processing). hmm

But: i was tring to enter custom commands at the remote side. Expecting the php script goes ahead when closing the connection. How to? Or do i have to use something like php/ssh2 and manage all the remote calls and answer posibilities at the local script?

--edit--

currently: i copy a shell script to the target server, login over there and execute it then.

To reproduce:

exec('ssh user@server "ls -al", $bufferList); -> shows the list of files from the remote server of 'user' $HOME path print_r($bufferList); -> local output, connection closed

exec('ssh user@server "bash -i -l", $bufferList); -> print_r($bufferList);` -> empty array, connection closed. Expected: Command Prompt.

Something to do with tty, but i have not found an answer yet.

f b
  • 115
  • 10

0 Answers0