Php rsync with exec() not working

execPHPrsync

Why this:

rsync -avz -e ssh /home/userneme/folder username@domain.com:/var/www/folder

works from cronjob and this:

exec("rsync -avz -e ssh /home/userneme/folder username@domain.com:/var/www/folder");

doesn't work.

I know exec is working because i have a few places in my appp that do convercion from pdf to jpg with ImageMagick (exec).

SOLVED

exec is working OK it was a permission issue on remote server. "Local" server is shared reseller account and remote server is my first VPS Ubuntu 10.10 LAMP box. If only I had a system administrator since i'm just a software developer forced to do this and i stink at it 🙂 Thank You all!

Best Answer

Your ssh keys should be also on apache home folder. If not, the rsync will not work.

Regards