Page 1 of 1

Problems registering Windows services

Posted: Fri Feb 13, 2009 11:38 am
by rickwestmacott
I am attempting to research and implement creating windows services via php using the PECL extension "extension=php_win32service.dll". The call itself is working fine as far as I know because I don't get a unknown function call when calling win32_create_service(). However the problem I am having is that no matter what machine (remote or local) I try to register the service on , I get a win32 error code 5 (Access Denied).

Code: Select all

 
<?php
$x = [color=#408000]win32_create_service[/color]( array(
   'service' => 'SERVNAME',
   'display' => 'Test PHP Service',
   'path' => 'C:\\path_to_executable_on_192.168.0.101\\executable.exe',
   'params' => 'param1 param2 .... paramn'
)
   , '192.168.0.101'
);
 
// Always returns access denied
echo "Win32 error: $x";
?>
 
There are no firewalls turned on (only for testing) on either the web server or the remote server (Where I really want to create the service). It seems to be a permissions thing but the permissions seem to be ok from what I can see. I have tried using the 'user' and 'password' parameters of a NETWORK SERVICES user, or Administrator to no avail.

Any assistance would be greatly appreciated.

Cheers

Rick

Re: Problems registering Windows services

Posted: Fri Feb 13, 2009 1:15 pm
by Weirdan
Are you running this code as administrator? Because, obviously, only administrators should be allowed to register services.

Re: Problems registering Windows services

Posted: Fri Feb 13, 2009 1:19 pm
by rickwestmacott
I have tried users that belong to the administrators group, but no luck.

Thanks for the thought.