Writing to a file in a directory that belongs to a different user using php

sdloanguys

New Member
I have a server that hosts several domains.From one of the domains, using a php script I want to be able to append a few lines to the .htaccess of other domains.For example from masterdomain.com I want to append some lines to the .htaccess of otherdomain.com. So from a php file in /home/masterdomain/www/ I want to append a few lines to the .htaccess located at /home/otherdomain/www.To do this I have written a shell script, when I run the shell script as root, it works but when running it via php, \[code\]exec('./write_htaccess.sh')\[/code\] it's not working, nothing happends. I checked and there are no errors returned.I have tried chmod u+s on write_htaccess.sh to try and make it run as root each time but that didn't work either, I might have set the s bit wrongly though.How could I achieve this? Do I have to give php root priviledges, what would be the best way to do this?
 
Back
Top