note 101837 added to function.exec
| From: | juan at laluca dot com | Date: | Thu, 13 Jan 2011 15:36:06 +0000 |
| Subject: | note 101837 added to function.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175714@lists.php.net to get a copy of this message | ||
I was trying to get an acceslist from a remote computer by executing cacls and parse it in php, all
in a Windows environment with Apache. First i discovered psexec.exe from Windows SysInternals.
But with the following line, I didn´t get anything, it get hunged, although from the command line
it worked nice:
<?php exec ('c:\\WINDOWS\\system32\\psexec.exe \\192.168.1.224 -u myuser -p mypassword
-accepteula cacls c:\\documents\\RRHH && exit', $arrACL ); ?>
To make it work I just followed the next steps:
- execute services.msc and find the apache service (In my case wampapache)
- Right button>Log On tab and change from Local System Account to a user created account, enter
the username and the password and restart the service.
(I added this user to the administrators group to avoid permissions problems but its not
recommended...)
It worked! And it may work with IIS too so try it if you have the same poblem....
Hope this helps someone, and sorry for my english
----
Server IP: 69.147.83.197
Probable Submitter: 62.99.70.211
----
Manual Page -- http://www.php.net/manual/en/function.exec.php
Edit -- https://master.php.net/note/edit/101837
Del: integrated -- https://master.php.net/note/delete/101837/integrated
Del: useless -- https://master.php.net/note/delete/101837/useless
Del: bad code -- https://master.php.net/note/delete/101837/bad+code
Del: spam -- https://master.php.net/note/delete/101837/spam
Del: non-english -- https://master.php.net/note/delete/101837/non-english
Del: in docs -- https://master.php.net/note/delete/101837/in+docs
Del: other reasons-- https://master.php.net/note/delete/101837
Reject -- https://master.php.net/note/reject/101837
Search -- https://master.php.net/manage/user-notes.php