note 98162 deleted from function.exec by visualmind
| From: | visualmind@php.net | Date: | Sat, 29 May 2010 09:22:47 +0000 |
| Subject: | note 98162 deleted from function.exec by visualmind | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-169708@lists.php.net to get a copy of this message | ||
Note Submitter: pyesley at yahoo dot co dot uk
----
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.