I\'m writing a script to automate deployment from my windows development PC to a shared hosting server.
I am getting different results depending on whether I execute
From the documentation:
Successive calls to exec()
If done on an interactive shell, the output you'd receive for the first pwd would (depending on how your system is setup) be different than the output of the second pwd. The above code snippet, however, will yield two identical lines.
The reason for this is that any "state changes" you make to the one-time shell are gone once the exec() has been ran and the channel has been deleted.
I see two options. Option 1:
Try the interactive shell examples with the read()
and write()
functions, which look pretty ugly to me.
Option 2:
Write your script as a shell script on the server and call the script with a single $ssh->exec()
call.