I want to execute a .exe file on my Apache server using a php script.
the procedure is as follow:
-
user comes, fills a html form
-
it goses to a php script
-
php script executes the
name.exefile -
php prints the output of the
name.exefile on the page.
I execute the name.exe normally from windows like this:
run--> cmd--> D:\name [command]
the name.exe needs to communicate with other files like libraries in the same directory.
the complete comand in cmd at windows is like this:
D:\name library.dll [input from user]
then program executes and prints some results in cmd window.
I actually want to run this program on my server form my clients.
I don’t know how, but I now there is a way to do this.
Another related question, is there any shell that I can install on Linux server and execute name.exe in it?
Please rethink your solution as this will likely create more problems (particularly security issues) than it solves. By having a PHP script execute your program you run the danger of a user entering the following into your form:
or
You want to limit user input to a very controlled subset so that you won’t get malicious command injection.
PHP does provide an
exec()but be very careful.