Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm having a problem with Apache HTTPD: I have a PHP application that executes the Windows command

shutdown -s -m \\<some machine> -t 0

It is used to shutdown unused servers in a network from a remote location.

The problem is, that I need to run that PHP app under a user account that also exists on the target machine and has the right privileges to execute the shutdown. I tried to run the Apache service that handles the PHP (php5_module) with an account that can execute the remote command (I tested it on the command line manually with that same account and it worked.) by setting User XYZ in httpd.conf but that didn't help.

The PHP script in question works perfectly if executed directly from the command line while logged in with the correctly privileged user account. If executed by the webserver, the called "shutdown" command responds with "Access denied".

Any suggestions?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The Problem is solved:

You can assign a specific user account to any windows service by right clicking it in the services list, going to the "Logon" tab and enter the user credentials there. The restart the service and it works.

Sometimes you just don't think of the simplest solutions ...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.