Harry Beasant
Harry Beasant

Reputation: 1014

Chaining SSH commands via PHP

I am running a SSH2 command via PHP and am trying to chain the commands to answer the password prompts from the bash script I run.

wget url-to-bash-script
bash name-of-file.sh

After this it will prompt for

MySQL Password:

And:

Retype password:

It will then proceed to install the packages for LAMP

I have tried something like this with no luck;

$ssh->exec( "wget URL;bash installLAMP.sh; password; password");

Thanks!

Upvotes: 0

Views: 263

Answers (1)

Matthew Scragg
Matthew Scragg

Reputation: 4638

What you might want to use is expect

Here are some examples on how to use it:

http://www.thegeekstuff.com/2010/10/expect-examples/

Upvotes: 1

Related Questions