title: PHP exec command on Nginx
body: <p>I'm trying to compile a C program with shell_exec() (I tried using exec() also). I'm using nginx on CentOS 6 as a server. Here is the command I try to execute:</p>
  
  <pre><code>/usr/bin/gcc /MyStuff/program.c -o program
  </code></pre>
  
  <p>I set the permissions of the files and the parent folders to 755 and also tried:</p>
  
  <pre><code>/usr/sbin/setenforce Permissive
  </code></pre>
  
  <p>But none of them seems to give result. The php is under user apache. The output of the command execution when </p>
  
  <pre><code>/usr/sbin/setenforce Permissive 
  </code></pre>
  
  <p>is: </p>
  
  <pre><code>collect2: cannot find 'ld'
  </code></pre>
  
  <p>When</p>
  
  <pre><code> /usr/sbin/setenforce Enforcing 
  </code></pre>
  
  <p>is</p>
  
  <pre><code> cc1: error: /MyStuff/program.c: Permission denied
  </code></pre>
  
  <p>Any ideas what's the problem?</p>