I have a home server with DynDNS setup, when I go to my dyndns page it loads my webpage specified, what I'd like to do is click a button on my webpage and the server runs a specified program possibly with parameters i.e. someprog.exe,

I don't want the Local computer to run the program, is this possible with PHP?

I don't know PHP well enough and I have a coworker that seems to think it should be possible, but I'll be darned if I can find a google search that explains it.

Anybody got any suggestions?

See the exec/shell_exec/system commands. If you're on Windows/IIS then you may have rights issues. Didn't get some programs running from PHP. *nix shouldnt be a problem.

See the exec/shell_exec/system commands.

Also note that I find these functions are a use at your own risk type functions because they can cause some servers to crash when security is tight on the server. And that includes the passthru function.

But running exe's with php, don't you think in the long term it would work out better to convert the exe's to php weather you find a converter or reprogramming it in php. The reason why I comment on that is what would be a possible use of running exe's remotely from a website. Seems like too much of a security problem to me.

The reasoning behind it is I would like to call a compiler to compile code on a server, so I can have all my files online and can access them from anywhere (VIA web) make updates and then compile them, making it easier to use for school so I wouldn't have to install anything and all the processing would be taken care of by the remote server computer.

Sounds like unless you are using a linux server to compile these exe files, it will make it possible for any good hacker to compile their own code on your server then do all sorts of nasty things to your server. But if you do want to continue, the functions have been mentioned above and use the dos/linux command line depending on which operating system you are using. In case you've forgotten those functions they are:

exec
shell_exec
system
passthru

You will find that all of those functions will function in simular ways and the 2 main ones are exec and passthru. Just don't be supprised if somebody is able to hack the server when performing such operations but I'm sure plenty of people in the 'viruses and other nasties' forum will help if your server is hacked with 1 or more nasties.

Are you trying to set something up, where as you make changes throughout the day, at a certain point, say once a night the server goes and compiles the source into a nightly build?

If this is more of your intentions and it doesn't need to be absolutely on demand you could setup a cron task that runs at a certain time or on timed intervals that calls the compiler and does the work.

I wanted to basically setup a "web text editor" and make it so if I do HW anywhere (school home work etc.) I can just login access the file via a web interface, then click save, then compile and it compiles the file and returns a link to the file, then I can test the exe on my local machine, I don't want to run the compiled file on the server, just basically create it.

This article has been dead for over six months. Start a new discussion instead.