[K12OSN] launch an application via php script?

Petre Scheie petre at maltzen.net
Mon Nov 8 15:46:47 UTC 2004


I don't think this can be done, at least not with PHP (or CGI, etc.).  PHP is a 
server-side scripting language, meaning whatever is called is owned by the 
server ID; I think you want, say, the gimp session to be owned by the user who 
clicks on an icon.  I can't think of any way that you could pass the $DISPLAY 
variable to the server, that the server would be able to make sense of, such 
that the gimp would appear on the correct terminal.  The problem, as I see it, 
is one of context: clicking the icon happens in the user's context, but it 
triggers a (PHP) script that runs in the web server's context.

Even if you could have apache call the gimp and pass it the correct display, you 
still have the issue of who owns and therefore controls the gimp pid.

It's an interesting concept, though, and I'd love to be proven wrong...but I 
just can't see how one would make it work.  I don't think you can get there from 
here.

Petre

Debbie Schiel wrote:
> Hi, This is for the PHP gurus...
> 
> Is there a way to launch an application (eg: 'gimp') via a php script?
> 
> I'm thinking of an intranet page for Preppies (kindergarten) with icons 
> linked to flash games on external sites but also icons linked to 
> internal applications. So I would need something like:
> 
> <a href="go.php?launch=myapp">TUX PAINT ICON</a>
> 
> and then
> 
> <? if ($launch==myapp) {
>             some php script here...
>         }
> ?>
> 
> I've tried exec() and shell_exec() without success.
> Any ideas?
> 
> Thanks,
> 
> Debbie
> 
> ps - is this considered 'off topic'?
> 




More information about the K12OSN mailing list