Problems registering Windows services

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rickwestmacott
Forum Newbie
Posts: 3
Joined: Fri Feb 13, 2009 11:22 am

Problems registering Windows services

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Problems registering Windows services

Post by Weirdan »

Are you running this code as administrator? Because, obviously, only administrators should be allowed to register services.
rickwestmacott
Forum Newbie
Posts: 3
Joined: Fri Feb 13, 2009 11:22 am

Re: Problems registering Windows services

Post by rickwestmacott »

I have tried users that belong to the administrators group, but no luck.

Thanks for the thought.
Post Reply