title: Using PHP's exec() gives error: Fatal: [Errno 2] No such file or directory; did you install
body: <p>I'm trying to use PHP to <code>exec()</code> a binary <code>casperjs</code>, </p>
  
  <pre><code>exec('casperjs /var/www/mysite/application/phantomjs/test.js');
  </code></pre>
  
  <p>but I am getting the error </p>
  
  <pre><code>Fatal: [Errno 2] No such file or directory; did you install phantomjs?
  </code></pre>
  
  <p>CasperJS runs on top of PhantomJS, both which I manually installed and created a link at <code>/usr/local/bin/phantomjs</code> and <code>/usr/local/bin/casperjs</code>. So I am guessing casperjs calls phantomjs when it runs.</p>
  
  <p>However it works fine when I ssh into the server and run</p>
  
  <pre><code>casperjs /var/www/mysite/application/phantomjs/test.js
  </code></pre>
  
  <p>What went wrong? I think <code>casperjs</code> cannot run <code>phantomjs</code> as a web user? If this is true, how can it be fixed?</p>