benphelps Posted March 22, 2009 Share Posted March 22, 2009 I need to run a system call from PHP as root. I need to use "vzctl, vzyum, vzrpm, vzquota", the openVZ tool set. I have tried to chown the file "root:root" but that didn't work. I tried to "sudo <command>", doesnt work. If anyone knows how to exec in PHP as root, please help me. Link to comment https://forums.phpfreaks.com/topic/150578-exec-or-system-as-root/ Share on other sites More sharing options...
Maq Posted March 22, 2009 Share Posted March 22, 2009 If you want to execute shell commands as root try: shell_exec('sudo -u root -S command_goes_here'); ?> Link to comment https://forums.phpfreaks.com/topic/150578-exec-or-system-as-root/#findComment-790944 Share on other sites More sharing options...
benphelps Posted March 22, 2009 Author Share Posted March 22, 2009 Like I said in my post, sudo doesnt work. It just freezes and stdin. Link to comment https://forums.phpfreaks.com/topic/150578-exec-or-system-as-root/#findComment-790953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.