Re: calling osascript command from php
Re: calling osascript command from php
- Subject: Re: calling osascript command from php
- From: James Sentman <email@hidden>
- Date: Fri, 15 Mar 2002 10:30:52 -0500
At 3:28 PM +0100 3/15/02, Paul Trilsbeek wrote:
Hi,
I'm trying to call the osascript shell command from a php page, but
I can't get it to run. For example a script like this:
osascript -e 'list disks'
runs fine from the command line, but when I try to call it from php like this:
shell_exec("osascript -e \'list disks\'")
it does not work. A normal unix command like "ls" works fine like this:
shell_exec("ls")
I can imagine it has someting to do with permissions, but I would
not know how to work around this then. I noticed (using sherlock)
that there is an invisible file called "osascript" in the /bin
directory, but I can't access it from the terminal.
Any ideas? Could I change permissions of this invisible "osascript"
file/command?
I've had the same problem calling it from Perl scripts when running
as the web server user. The problem is that even osascript tries to
initialize core graphics and the www user has no access to this, so
the program crashes as soon as you start it. If you turned on crash
reporting in the console you'd get a log that shows it dies when
calling to init core graphics.
I've tried using setuid scripts to force the script to run as a
different user, but that didn't work either. It's possible I didn't
set it up right though.
Currently I don't know any solution to this. You can change the user
that the web server runs as, or somehow give it more access so that
it can init core graphics. I would actually consider it a bug that
osascript as a command line tool wastes time by calling any core
graphics routines at all.
There would be other security concerns associated with running the
web server as a regular user but the details are escaping me at the
moment. I think that you'd have to make the changes in netinfo rather
than the config files that I'm familiar with. Perhaps it's time to
read all the netinfo literature at apple...
Does anyone else have any ideas?
James
--
_________________________________________________________________________
James Sentman <email@hidden>
http://www.sentman.com
Enterprise server monitoring with:
http://whistleblower.sentman.com/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.