Run EXE on server using PHP

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
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Run EXE on server using PHP

Post by waradmin »

Is it possible to run an EXE file on the server using a link (in PHP) if the file is currently not running. Or even if it is running, is it possible to use PHP to run a file located for example in C:/debug/run_this.exe on the server using a PHP page on the web server?

Thanks in advance.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

system() and its siblings. Be aware that permissions are quite important.
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post by waradmin »

Im trying:

Code: Select all

<?php
system ("C:\\local\\debug\\server.exe");
?>
And am having no luck.
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

use exec(string path_to_function) function to use the system call or use system(string path_to_binary). This will only be possible if you are not using PHP in safe mode.

There are serveral other functions like passthru() as well.

try visiting this url for more info : http://www.php.net/manual/en/function.system.php


cheers,
dibyendra
Post Reply