title: How to run Shell Script/AppleScript in PHP?
body: <p>I'm trying to run AppleScript in PHP. The following is my code: </p>
  
  <pre><code>&lt;?php
      echo "Hello World!";
      shell_exec('osascript -e \'tell app "Finder" to make new Finder window\'');
      shell_exec('osascript -e \'display dialog "hello"  \'');
      shell_exec('osascript ~/openExcel.scpt');
      echo "DONE";
  ?&gt;
  </code></pre>
  
  <p>When I run each command individually in terminal, I can get the expected result. However, when I open this .php file in server as a webpage, I can only get <code>"Hello World!DONE"</code>. The middle part (3 <code>exec</code> commands) have no output result at all. I don't understand.</p>