|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66746 win32_create_service, user and password parameters
Submitted: 2014-02-20 09:56 UTC Modified: 2018-10-08 18:46 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: asd12daqdqv at mail dot ru Assigned: jbnahan (profile)
Status: Closed Package: win32service (PECL)
PHP Version: 5.4.25 OS: Windows Server 2008 R2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: asd12daqdqv at mail dot ru
New email:
PHP Version: OS:


 [2014-02-20 09:56 UTC] asd12daqdqv at mail dot ru
I want to create Windows service with administrative permissons using win32_create_service function. Web-server IIS7 works from administrator. PHP works as FastCGI. 

PHP has been downloaded from: 
Win32 service library has been downloaded from:

If service creates witout user and password parameters it returns 0 and means service created. But if i run win32_create_service with user and password parameters it returns 2.

All paths, user and password is correct.

Windows system error codes:

Error 2: The system cannot find the file specified.

I didn't find actually information about this error on PHP sites/forums.

Sorry for my english. I hope you understand me.

Test script:
$service_install = win32_create_service(Array(
	'service'     => 'service_name',
	'display'     => 'Service Extended Name',
	'description' => 'Service Description',
	'path'        => 'C:\php\php.exe',
	'params'      => 'C:\inetpub\wwwroot\service.php' . ' run',
	'user' => 'Administrator',
	'password' => 'test123', 


# Output: int(2)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-05 10:53 UTC] asd12daqdqv at mail dot ru
I'm sorry. It's not a bug. There are 2 features:
1. User key must be provided in MACHINENAME\User format or just .\User
2. User key must be in Win-1251 (only if cyrillic?) charset: 'user' => iconv('UTF-8', 'windows-1251', '.\Администратор')

So next code is working perfectly:

$service_config = array(
	'service'      => 'service_name',
	'display'      => 'Service Extended Name',
	'description'  => 'Service Description',
	'path'         => 'C:\php\php.exe',
	'params'       => 'C:\inetpub\wwwroot\service.php' . ' run',
	'user'         => '.\Администратор',
	'password'     => 'test123', 
function utf8_to_win1251($in) {
	return iconv('UTF-8', 'windows-1251', $in);
$service_config = array_map('utf8_to_win1251', $service_config);
$service_install = win32_create_service($service_config);


# Outputs int(0)
 [2017-05-02 21:09 UTC] jean-baptiste at nahan dot fr

Have you the same issue with PHP 7.0+ ?

The new version 0.2.1 is now available.
 [2018-10-08 18:46 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: jbnahan
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 05:01:29 2024 UTC