Jump to content

Shell_Exec on windows with Apache


$username

Recommended Posts

I ran into an issue running cmds through shell_exec. When you trigger a shell_exec it will open the exe as the Apache service user. By default Apache installs as a local system account. So if you need to connect to a remote server to run a cmd it will hang in the task manager.

 

example shell_exec("psexec \\\\remoteComputer -i -d -s dnscmd /zoneadd domain.com /primary")

 

When a cmd needs to access other servers you will need to make the Apache service run as a user that has access to other remote servers.

 

http://httpd.apache.org/docs/2.2/platform/windows.html

See the section about running Apache as a service

 

This may not work for all cases but it seems to work for my issues when running cmds that needed more privileges

 

-Brett

 

 

Link to comment
https://forums.phpfreaks.com/topic/193114-shell_exec-on-windows-with-apache/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.