Hi !
Here's my goal : I have a Windows XP PC with all the source code in it and a development database. Let's call it "pc.dev.XP". I have a destination computer that runs Linux. Let's call it "pc.demo.Linux". Here's what I've done on "pc.dev.XP" (just so you get the context) :
- installed all cygwin stuff
- created a valid rsa key and put it on the dest backup computer so that ssh doesn't ask for a password
- rsync works pretty well this way
If i try to do this on "pc.dev.XP" via a command line :
cd \cygwin\bin
ssh [email protected] "cd /var/www && ls -al"
this works perfectly without asking a password Now here's what I want to do on the "pc.dev.XP":
- launch a php script that extract the dev. database into a sql file
- zip this file
- transfer it via ftp to the "pc.demo.Linux"
- log to the "pc.demo.Linux" and execute "unzip then mysql -e "source unzipped file"
if I run on "pc.dev.XP" manually :
putty -load "myconf" -l Fred -pw XXX -m script.file.that.unzip.and.integrates.sql
this works perfectly. Same for :
cd \cygwin\bin
ssh Fred@dest "cd /var/www && ls -al"
If I try to exec() in php (wamp installed on "pc.dev.XP") those scripts they hangs. I'm pretty sure this is because the user is "SYSTEM" and not "Fred", and putty or ssh ask for a password but maybe I'm wrong.
Anyway I'm looking for a way to automate those 4 tasks I've described and I'm stuck because exec() hangs. There's no problem with safe_exec_mode or safe_exec_dir directives, they're disabled on the development machine, thus exec() works pretty well if I try some basic stuff like exec("dir")
Any idea what I could do / check / correct ?