Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

I am unable to execute commands (shell_exec) with php, and read on stackoverflow / here that the solution was to run apache as root. Is this possible / is this a totally wrong solution? When I try to execute commands with php it does nothing. I am trying to run a python script with variables from a PHP script and it is not working, it does nothing. Doing this on a centos vps

share|improve this question

marked as duplicate by Matthew Ife, dawud, Jenny D, Ward, Ladadadada Jul 3 at 15:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 1 down vote accepted

Standard builds of Apache don't tend to support running the httpd deamon as root. Typically (for RHEL and CentOS anyway) it runs under the apache account.

What you could do, if you're wanting to run your scripts from PHP as a root user, it add apache to the sudoers file. This will allow the apache account to impersonate the root user.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.