Can't delete files unless via root

Hi,

I transfered a bunch of files from my old server (red hat) to a new one (cent os). Now I'm trying to delete those using the following in php:

shell_exec("rm -rf /home/user/www/files/xxx/");

but it's not working. it will only delete the folder in case I run the command on SSH logged as root, and as php runs as nobody, it wont work.

I tried using chown and chgrp, twice, and still didnt work. The permissions are no big deal, but I even tried chmoding everything that I wanted to delete as 777 and no luck.

Also tried this:

shell_exec("sudo rm -rf /home/user/www/files/xxx/");

And guess what, no luck again.

I have thousands of stuff to delete, and I need PHP to be able to do it. What should I do to make it work?

Thanks in advance

 

 

 

 

Top