Before everyone starts attacking with “security risks,” “impossible to do,” stop there and read the ENTIRE post
I have a web server configured from my home laptop, which serves as a web server for games trying to create a graphical interface, so it’s easier for us to support the server and try to use batch files to perform actions on the computer
So, to put this in perspective, I have an index index index.php
<form method="post"> <input type="submit" name="startServer" value="Start Server"> </form> <? if(isset($_POST['startServer'])){ exec('batch/startServer.bat'); } ?>
And my startServer.bat will run on the laptop on which the server is running, and will perform all the steps necessary to start our game server, so there is another directory "Instance" containing excutable "Server.exe", which will run the command file
The problem is when starting the web server, and testing this does not work, if I open the batch file directly, it works, but it looks like the PHP code does not work
For clarification, I use apache and my browser is chrome
And just a quick question for those who want to answer the route that goes, right? Using php will allow you to run everything on the machine where the server is located, so the end user will see only the graphical interface, and the server will run batch files and everything on the web server, and not on the local machine, if that makes sense?
EDIT: To be more clear what happens with exec exec functions, but it just hangs as the application loads. I need a solution that will actually open the application, this is my main computer, for example, if I wanted to open notepad I press a button on the web server and notepad will open on the computer
EDIT 2: I would like to point out that I do not need the need to use the exec function, and I have tried all the answers to date. 7/19/2017: 3: 45pm none are working if I do something in sortings echo exec('start text.bat'); , I will get This is a test to show your batch is working and just just echo ..... in the batch file, the main problem I am facing is that it doesn’t physically show the open file, like GUI display just take a notepad, eg
I can open the notepad and get some return value while my batch file closes the notepad after it is completed, however the graphical interface for the notepad is never displayed, and this is very important
I read in several articles about using apache as a service, which I'm sure I have, but I know that xaammp has privilege privileges, and I checked the box that says "Allow apache to interact with the desktop," however The GUI is missing popping thats the main point, I assume that I am trying to understand, I need to display the GUI, and not just open the file as a background service.
If it makes the answer easier, I'm open to switching programming languages, if one that can do what I need is easier