I don't know what the deal is here…
So I want to run an applescript: sudo osascript myscript.scpt
This works fine in the terminal, but not when I execute it via PHP's exec()
; nothing happens. The console says
no tty present and no askpass program specified ; TTY=unknown ; …
I did my research, and it seems I'm missing the password for the sudo
command. I tried a couple different ways to get around this, including:
- writing
%admin ALL=(ALL) ALL
in /etc/sudoers
- and
proc_open()
instead of exec()
none of which seem to be working, consequently driving me CrAzY!
So basically, is there a clear-cut way to get PHP to execute a simple terminal command?
EDIT: to clarify, myscript.scpt
is a simple appleScript that changes the onscreen UI (for a larger project). In theory, simply osascript myscript.scpt
should be enough, however the sudo
is for some reason necessary to invoke some response from the system. If the sudo
could be somehow eliminated, I don't think I would be having this permissions problem.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…