[SOLVED]using php to run a external application

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ryuuka
Forum Contributor
Posts: 128
Joined: Tue Sep 05, 2006 8:18 am
Location: the netherlands

[SOLVED]using php to run a external application

Post by ryuuka »

back again

this time i want the app i've been working on all this time to open
a external application(not a webapp, real one like vncviewer)
but the way i've tried it, just linking will open a download as i knew it
probably would.

do you have any pointers on where to look for more information on this?
Or small samples of code or a site wich has a tutorial of some kind.

security is not an issue it's only accesible to the admins on this network.
believe me i've tried.

thanks in advance
Last edited by ryuuka on Thu Nov 09, 2006 4:20 am, edited 1 time in total.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

stab in the dark... http://us3.php.net/exec ? I'm not sure though
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

Go to this thread for more information:
viewtopic.php?t=57961

Dibyendra
ryuuka
Forum Contributor
Posts: 128
Joined: Tue Sep 05, 2006 8:18 am
Location: the netherlands

Post by ryuuka »

k got the function etc
i've tried my fair bit of these commands but i keep getting this error:
Warning: exec() [function.exec]: Unable to fork [vncviewer.exe] in D:\wwwroot\gispen.net\gispen\exec.php on line 5
been reading up on this error and it's being suggested that it's a security issue.
And because the php.ini i located in the windows dir of one of the servers i don't
have access to it. Can you give me any hints on how to approach this problem.

is it a security problem or something else?
this is my code

Code: Select all

<?php
error_reporting(E_ALL); 
ini_set('display_errors', TRUE);

echo exec('vncviewer.exe');

?>
ps. this is the complete page acording to php.net this should work
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

exec(), passthru(), system(), shell_exec() etc depends on the php environment. They are disabled on safe mode.If it's not in safe mode and you're getting errors, the path to the binary may not be correct. Is 'vncviewer.exe' lies on same directory where you are executing the script ? Try giving the absoulute path or relative path of the binary where it is installed.
ryuuka
Forum Contributor
Posts: 128
Joined: Tue Sep 05, 2006 8:18 am
Location: the netherlands

Post by ryuuka »

thanks it works now

needed to add a path (/app/vncviewer)
can't believe i overlooked that :(
Post Reply