How to run Shell Script/AppleScript in PHP?

Monday, May 5, 2014

I m trying to run Shell Script/ AppleScript in PHP. The following is my code:



<?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";
?>


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 "Hello World!DONE". The middle part--3 "exec" commands, have no output result at all. I don't understand. Any help?







http://ift.tt/1lTExEi