I have a script that basically works as an autoinstaller for a CMS script. The script NEEDS to run as root in order to access the directories necessary to install the script on a users account. The problem is that when script are called through apache they run as nobody and therefore cannot run the necessary files. My question is if there is a way to force apache to run as root when processing some script. I am already aware of the security aspects of doing this but there are many security checks built into the script. Does anyone know a practical way to do this?
Apache doesnt actually run as nobody, it will run as www, www-data, apache depending on the OS. You cant force apache to run as root on the script execution but you can give the www user root privileges. The problem with this is that any script that runs on your site has root privileges. Can you get by the permission by using chmod() inside your php script?