title: php command line exec() multiple execution and directories?
body: <p>I am trying to Execute a multiple commands in php using exec() and shell_exec but i am getting a null value back which i shouldn't and nothing is happening (if i copy and paste the strings below in the command line it will work fine and accomplish the job needed) this is the commands i am using:</p>
  
  <pre><code>$command = "cd /../Desktop/FolderName;";
  $command .= 'export PATH=$PATH:`pwd`;';
  $command .= 'Here i execute a compiler;';
  </code></pre>
  
  <p>and then i use the escapeshellcmd()</p>
  
  <pre><code>$escaped_command = escapeshellcmd($command);
  </code></pre>
  
  <p>then</p>
  
  <pre><code>shell_exec($escaped_command);
  </code></pre>
  
  <p>any ideas what i am doing wrong and i also tried escapeshellarg() instead of escapeshellcmd()?</p>
  
  <p><strong>Solution: the Problem was the permission of the execution compiler for other owners is non and this was the problem.
  because when you are using <code>exec()</code> function in php the owner of the file will be www-data so you need to give permission for the www-data either from the ACL of ubuntu or whatever linux based operating system(you can know the owner by doing this <code>exec('whoami')</code>), or by the files you need to execute.</strong></p>