Page 1 of 1
exec() with Mac open command
Posted: Wed Aug 25, 2010 9:33 am
by Billiken
I want to do something like the following:
Code: Select all
exec('open /Applications/Safari.app');
I can run exec on other commands like:
Code: Select all
$output = exec('ls -ll);
echo $output;
And I can run the open command via Terminal, but I can't seem to run the open command via a PHP page using exec().
I've tried the permissions of the .app file at 777 and the open binary at 777.
Any suggestions?
Re: exec() with Mac open command
Posted: Wed Aug 25, 2010 2:59 pm
by Gargoyle
if what you are trying to do is call an application like safari and have it suddenly open in a new window or so, this isn't at all possible with PHP.
Re: exec() with Mac open command
Posted: Wed Aug 25, 2010 3:03 pm
by bradbury
don't use a mac
Re: exec() with Mac open command
Posted: Wed Aug 25, 2010 4:56 pm
by Billiken
Gargoyle wrote:if what you are trying to do is call an application like safari and have it suddenly open in a new window or so, this isn't at all possible with PHP.
I'm trying to have the application launch on the machine running php/apache.
I think it may have something to do with the _www apache user. But I don't know what sort of permissions I have to give that user.
Re: exec() with Mac open command
Posted: Wed Aug 25, 2010 11:48 pm
by Gargoyle
if you want the program to keep running, you need to redirect its output to a file:
Code: Select all
/dev/null < exec('open /Applications/Safari.app');
I don't know how to do that on Mac though.