[英]sync a remote server folder with local server folder using rsync in php?
This code in php it doesn't sync the "test" folders. 此代码在php中不会同步“测试”文件夹。
php 的PHP
exec('/usr/bin/rsync -a /etc/test root@x.x.x.x:/etc/test');
But in shell 但在壳
rsync -a /etc/test/ root@x.x.x.x:/etc/test/
is worked. 工作。 So I need to sync those "test " folders by using php file.How could I do that? 所以我需要使用php文件同步那些“测试”文件夹。我该怎么办?
First you need to check if you need to be a root or (sudo user) for running rsync. 首先,您需要检查是否需要以root用户或(sudo用户)身份运行rsync。 If yes then exec command will only work if it is run by same user on php-cli (not on browser by apache user). 如果是,则exec命令仅在由同一用户在php-cli上运行时才起作用(而不是由apache用户在浏览器上运行)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.