title: operable program or batch file.'phantomjs' is not recognized as an internal or external command, operable program or batch file
body: <p>I am trying to exec phantomjs in PHP on my Windows 7 machine. The strange thing is that if I type "phantomjs --version" in command line, it will execute successfully. But if I put it into code,</p>
  
  <pre><code>echo exec("set PATH=%PATH%;C:\phantomjs");
  echo exec("phantomjs --version 2&gt;&amp;1", $output);
  
  foreach($output as $result) {
    echo $result, '&lt;br&gt;';
  }
  </code></pre>
  
  <p>Gives the following output:</p>
  
  <blockquote>
    <p>operable program or batch file.'phantomjs' is not recognized as an internal or external command, operable program or batch file.</p>
  </blockquote>
  
  <p>I have checked my PATH setting, and C:\phantomjs is there. </p>
  
  <p>What could be the problem here?</p>