PHP Velho Oeste 2024

win32_start_service

(PECL win32service >=0.1.0)

win32_start_serviceサービスを開始する

説明

win32_start_service(string $servicename, string $machine = ?): void

指定したサービスの開始を試みます。 管理者権限、 またはサービスのACLで適切な権限が設定されたアカウントが必要です。

パラメータ

servicename

サービスの短い名前。

machine

オプションのマシン名。指定しなかった場合、ローカルマシンが使用されます。

戻り値

値を返しません。

バージョン 1.0.0 より前では、 成功した場合に WIN32_NO_ERROR を返していました。パラメータに問題がある場合は false、失敗した場合は Win32 エラーコード を返します。

エラー / 例外

servicename が空の場合、 ValueError がスローされます。

エラー時には、Win32ServiceException がスローされます。

変更履歴

バージョン 説明
PECL win32service 1.0.0 引数に不正な値があった場合、 ValueError をスローするようになりました。 これより前のバージョンでは、false を返していました。
PECL win32service 1.0.0 エラー時に Win32ServiceException をスローするようになりました。 これより前のバージョンでは、 Win32 エラーコード を返していました。
PECL win32service 1.0.0 戻り値の型が void になりました。 これより前のバージョンでは、mixed でした。
PECL win32service 0.3.0 ACLが別のアカウントに設定されていた場合、 この関数には管理者権限が不要になりました。

参考

add a note add a note

User Contributed Notes 2 notes

up
-1
gunday at poczta dot onet dot pl
16 years ago
If you get a 1053 error when trying to launch your service, check your service script for errors!

E.g. if you have some syntax errors, the service will attempt to run the php interpreter, but the script won't answer to the service manager with
win32_start_service_ctrl_dispatcher('servicename').

Don't think it is because the call comes to late. It just never came, because there were errors. Test your services with CLI php and then try to run the service.
up
-4
edo888 at gmail dot com
14 years ago
[This] can solve 1053 issue.
You just need to add " if you have spaces in your path...

<?php
win32_create_service
(array(
       
'service' => 'COMPLAINTS',                 # the name of your service
       
'display' => 'Receive email complaints and direct them to the website', # description
       
'params' => '"' . __FILE__ . '"' . ' run', # path to the script and parameters
   
));
?>
To Top