|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-02-20 09:56 UTC] asd12daqdqv at mail dot ru
Description: ------------ 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: http://windows.php.net/downloads/releases/php-5.4.25-nts-Win32-VC9-x86.zip. Win32 service library has been downloaded from: http://windows.php.net/downloads/pecl/releases/win32service/0.1.0/php_win32service-0.1.0-5.4-nts-vc9-x86.zip 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: http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382%28v=vs.85%29.aspx 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', )); var_dump($service_install); exit; # Output: int(2) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 05:00:01 2025 UTC |
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); var_dump($service_install); exit; # Outputs int(0)