you probably have to give user nobody.nobody permissions to the files you're backing up

i have given all permissions because i have used
chmod 0777 file/folder name

can i do soemthing like login as root from php script and untar the file. if yes, what commands i have to use for logging in as root from php

not so sure, try to chown, not just chmod.
and as for root under php... try sudo?

will the command be something like

exec("sudo -u root /usr/trial/x.tar")

just read man sudo (look for silent execution, no passwords asked) and add nobody to sudoers