pHp and Osascript

I have a project in which I am trying to create a web interface to control and ARD server. What I am trying to do is have a web interface (through apache and php) run applescript which controls ARD which then controls computers in a lab environment. I have gotten as far is writing the entire web front end, but I can't get php to run osascript to do the applescripts. I have tried changing apache's user to an administrator and have verfied that change was accepted by doing a phpinfo();. I get no error and no feedback from a line like this

+echo shell_exec("osascript scripts/test.applescript");+

where test.applescript is a simple script like

+return "hello world"+


however I know that I can run command line codes b/c

+echo shell_exec("ls -f");+

returns correctly.

I have heard of other people having success running applescripts from php, but I am at my wits end. Does anyone have any ideas?

Message was edited by: wmarbut b/c I formatted it incorrectly

MacBook Pro, Powerbook G4, XServe G5, Mac OS X (10.4.9), This is on the xserve running os x server 10.4.9

Posted on Aug 1, 2007 10:16 AM

Reply
3 replies

Aug 1, 2007 6:25 PM in response to wmarbut

osascript has large limitation in that it can only run as root or as the currently logged in user. If you were to try and run the command manually, as such:

/usr/bin/sudo -u www osascript scripts/test.scpt

You would get the error:

kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

pHp and Osascript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.