| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
Problem: I could not get exec("myprogram.exe") to run a executable file. I could see the myprogram.exe launch into the Task Manager, but then the .php script would hang.
I tried system(), and launching .bat files. Nothing worked.
System: I'm running windows XP SP2, with Apache.
Solution:
Change the user associated with apache. The process httpd.exe was running as the user: SYSTEM. I changed it to run under a different user, (me). Now perhaps this isn't great for security, but it does work.
To do this go to Control Panel->Administrative Tools->Services.
Find the Apache Service and stop it. Right click to bring up it's properties. Go to the LogOn tab And change the service to run under a different account. You have to add a password. It didn't work when I put it to an account without a password.
Then restart the service Apache. Check in the task manager to see that httpd.exe is not running under the user SYSTEM but rather a new user with lots of privileges.
Now exec(myprogram.exe) will launch and execute myprogram.exe.
Maybe another user can tell me what security options I should use to keep this solution without sacrificing too much security.
----
Server IP: 69.147.83.197
Probable Submitter: 76.168.4.235
----
Manual Page -- http://www.php.net/manual/en/function.exec.php
Edit -- https://master.php.net/note/edit/98162
Del: integrated -- https://master.php.net/note/delete/98162/integrated
Del: useless -- https://master.php.net/note/delete/98162/useless
Del: bad code -- https://master.php.net/note/delete/98162/bad+code
Del: spam -- https://master.php.net/note/delete/98162/spam
Del: non-english -- https://master.php.net/note/delete/98162/non-english
Del: in docs -- https://master.php.net/note/delete/98162/in+docs
Del: other reasons-- https://master.php.net/note/delete/98162
Reject -- https://master.php.net/note/reject/98162
Search -- https://master.php.net/manage/user-notes.php