Link to home
Start Free TrialLog in
Avatar of haidermosawi
haidermosawi

asked on

Getting rsync to work on Windows, run from a PHP script

Hello,

I'm using the symfony framework, and am trying to use rsync to update my server files.

I have PHP 5.2.3 installed, and am using cwRsync (my computer is Windows XP via Parallels, on a Mac).

When I run symfony's command in DOS to execute rsync, I get the following command:

rsync --progress --dry-run -azC --delete --exclude-from=config/rsync/exclude.txt -e "ssh -p22" ./ user@host.com:/usr/home/user/myproject/

But nothing else happens. When I cancel the command (by pressing Ctrl-C), I get the error:

Error in my_thread_global_end(): 1 threads didn't exit
Terminate batch job (Y/N)?

The code that's causing the command line to freeze is:

ob_start();
passthru($cmd.' 2>&1', $return);
$content = ob_get_contents();
ob_end_clean();

symfony is meant to use SSH to handle rsync, and I contacted my host, and they said they support both rsync and SSH.

I'm not sure where the error is happening, but I suspect that this is a PHP issue.

Apologies if my suspicion is incorrect, and I would appreciate any help in directing me to where the problem and solution might be.



ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of haidermosawi
haidermosawi

ASKER

Thanks a lot..

I managed to get rsync working the way you prescribed. But I'm sure there's a way of getting it to work through PHP, otherwise symfony wouldn't be using it.