title: Running shell commands in .php file from command-line
body: <p>I have a series of shell commands I want to put in a program and execute the program from the command line. I decided to use PHP for this so currently I am trying to get the most basic shell commands to run.</p>
  
  <p>Save as build.php</p>
  
  <pre><code>&lt;?php
  shell_exec('cd ..');
  echo "php executed\n";
  ?&gt;
  </code></pre>
  
  <p>From the command-line</p>
  
  <pre><code>php build.php
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>php executed
  </code></pre>
  
  <p>Php executes correctly but I'm still in the same directory. How do I get shell_exec( ... ) to successfully call a shell command?</p>