Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Launching a desktop application from the web

Launching a desktop application from the web
Thread Tools
Synotic
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Oct 5, 2007, 11:34 AM
 
Hi guys,

I am developing a web application, and one of its features includes launching a VNC client with a particular IP. I know this can be dangerous, but it's an internal system that will be locked down. I can do this from Terminal like this:

open "vnc://146.122.43.102"

Which I can easily wrap into, say, a PHP script:

<?php
exec('open "vnc://146.122.43.102"');
?>

And if I save this as a file, say openvnc.php and run it from the Terminal:

php openvnc.php

It launches the appropriate VNC client with that IP address (Chicken of the VNC in my case).

The odd thing though, is that if I put the PHP file in my /Library/WebServer/Documents/ folder and then run it from Safari:

http://localhost/openvnc.php

It doesn't execute the command. Other, simpler commands will run from PHP, like "ls" or "pwd" however. I'm assuming this is a security precaution, but I know that it's definitely possible (for instance, the iCapture website, which lets you see what your website looks like in Safari, I'm assuming it's launching an AppleScript from the web script). Trying to run "osascript" also doesn't work, for that matter.

I am open to using other solutions than PHP. Does anyone know how I can get this working? Thanks!

P.S. This is probably clear from my post, but the website and the VNC viewer will be running on the same box, a Mac.
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Oct 5, 2007, 05:49 PM
 
I think the problem is that the Web server is running as a user who doesn't have a running windowserver process.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Synotic  (op)
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Oct 6, 2007, 03:10 PM
 
You were spot on. I changed the user and everything is working. Thanks!
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:50 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,