Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
PHP のこのコードは、「テスト」フォルダーを同期しません。
php
exec('/usr/bin/rsync -a /etc/test root@x.x.x.x:/etc/test');
しかし、シェルでは
rsync -a /etc/test/ root@x.x.x.x:/etc/test/
働いています。そのため、php ファイルを使用してこれらの「テスト」フォルダーを同期する必要があります。
まず、rsync を実行するために root または (sudo ユーザー) になる必要があるかどうかを確認する必要があります。はいの場合、exec コマンドは、php-cli で同じユーザーによって実行された場合にのみ機能します (Apache ユーザーによるブラウザーではありません)。