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? Link to comment https://forums.phpfreaks.com/topic/114703-php-symlinks/ Share on other sites More sharing options...
webent Posted July 14, 2008 Author Share Posted July 14, 2008 *bump* Link to comment https://forums.phpfreaks.com/topic/114703-php-symlinks/#findComment-590003 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. Link to comment https://forums.phpfreaks.com/topic/114703-php-symlinks/#findComment-590019 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? Link to comment https://forums.phpfreaks.com/topic/114703-php-symlinks/#findComment-590027 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. Link to comment https://forums.phpfreaks.com/topic/114703-php-symlinks/#findComment-590031 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. Link to comment https://forums.phpfreaks.com/topic/114703-php-symlinks/#findComment-590057 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.