webent Posted July 14, 2008 Share Posted July 14, 2008 Question about php & SymLinks... I can make the symlinks in ssh as root, but how can perform that action in php? for example, this is what I use in ssh terminal cd /home/seconddomain/public_html/shoppingcart ln -s /home/maindomain/public_html/shoppingcart/images images So, from what I could tell, I would do this in php $symlink_source = "/home/maindomain/public_html/shoppingcart/images"; $symlink_destination = "/home/seconddomain/public_html/shoppingcart/images"; exec("ln -s $symlink_source $symlink_destination"); But it does not work, I'm assuming its hitting a permission error, I'm running the script from the maindomain. Is there anyway for the script to be ran with root privledges or does anyone have an idea as to how to overcome this issue? Quote Link to comment Share on other sites More sharing options...
webent Posted July 14, 2008 Author Share Posted July 14, 2008 *bump* Quote Link to comment Share on other sites More sharing options...
trq Posted July 14, 2008 Share Posted July 14, 2008 This is a permissions issue, not really php related. You shouldn't need root perms to issue such a command and if you really do, you won't be able to do it securely from php. Quote Link to comment Share on other sites More sharing options...
webent Posted July 14, 2008 Author Share Posted July 14, 2008 Ok, thanks Thorpe... From what my server people told me, a non-root user cannot access public_html files, even if that user has multi-domain permissions, only root can, so how does one run php scripts that require root privledges? Quote Link to comment Share on other sites More sharing options...
trq Posted July 14, 2008 Share Posted July 14, 2008 so how does one run php scripts that require root privledges? You need to configure sudo to allow the apache process to execute the given command as root, this is however a very bad idea. A better idea might be to give permission for the apache process to write to /home/*/public_html. Quote Link to comment Share on other sites More sharing options...
webent Posted July 15, 2008 Author Share Posted July 15, 2008 Ok, Cool... I'll look into that, thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.