applescript launched from terminal but not from php
I have an applescript which writes a log file. It works perfectly if launched from the terminal, but i need to launch it from a php script. For achieving this I use the exec functio开发者_StackOverflow中文版n of php but nothing happens.
The applescript is owned by the user "administrator" If from php's exec i launch "whoami" I get back "administrator" so I guess it's not a problem of permission.(the applescript has also execution permission on it)
The applescript works both in this ways:
administrator$ ./myApplescript.app
administrator$ osascript myApplescript.app
If I try to run the very same commands inside php nothing happens.
Someone faced something similar? Thanks in advance! Best regards
P.S. The webserver is MAMP on mac Os x
Have you tried
<?php
exec('osascript path/to/script/myApplescript.app');
?>
make sure that the path you call is actually correct and that the webserver has access to this file.
Make sure a user is logged in on the Mac you're running the php from too or else it won't work properly.
精彩评论