First, you need to check if you need to be a root or (sudo user) for running 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). i.e. Which user you are loggined into shell for run rsync
.
If it is root or any elavated permission user with sudo permission then, This rsync
command may not be available to apache/www-data
user which is working when php script run from browser.
So You try to make a normal user and login through it, Then try rsync
if you are successful then it may be interesting to see what are other problems can be, But if you getting access/permission denied then obviously you can not run this script at-least on browser.
Besides this One more thing permission may not be directly related to rsync
command itself but with folder /etc/test/
which is owned by root user in normal scenario.