mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Win32Service Doc update
Original patch provided by jbnahan@. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@346866 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
1046d428ad
commit
8e9b6dd78f
3 changed files with 326 additions and 16 deletions
|
@ -815,6 +815,51 @@
|
|||
</table>
|
||||
</section>
|
||||
|
||||
<section xml:id="win32service.constants.recovery-action">
|
||||
<table>
|
||||
<title>Win32 Recovery action</title>
|
||||
<tgroup cols="3">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Constant</entry>
|
||||
<entry>Value</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row xml:id="constant.win32-sc-action-none">
|
||||
<entry><constant>WIN32_SC_ACTION_NONE</constant></entry>
|
||||
<entry>0x00000000</entry>
|
||||
<entry>
|
||||
No action.
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-sc-action-reboot">
|
||||
<entry><constant>WIN32_SC_ACTION_REBOOT</constant></entry>
|
||||
<entry>0x00000001</entry>
|
||||
<entry>
|
||||
Restart the server.
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-sc-action-restart">
|
||||
<entry><constant>WIN32_SC_ACTION_RESTART</constant></entry>
|
||||
<entry>0x00000002</entry>
|
||||
<entry>
|
||||
Restart the service.
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-sc-action-run-command">
|
||||
<entry><constant>WIN32_SC_ACTION_RUN_COMMAND</constant></entry>
|
||||
<entry>0x00000003</entry>
|
||||
<entry>
|
||||
Run a command.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section xml:id="win32service.constants.serviceinfos">
|
||||
<table>
|
||||
<title>Win32 Service informations</title>
|
||||
|
@ -828,53 +873,137 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<row xml:id="constant.win32-info-service">
|
||||
<entry><constant>Win32_INFO_SERVICE</constant></entry>
|
||||
<entry><constant>WIN32_INFO_SERVICE</constant></entry>
|
||||
<entry>"service"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-display">
|
||||
<entry><constant>Win32_INFO_DISPLAY</constant></entry>
|
||||
<entry><constant>WIN32_INFO_DISPLAY</constant></entry>
|
||||
<entry>"display"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-user">
|
||||
<entry><constant>Win32_INFO_USER</constant></entry>
|
||||
<entry><constant>WIN32_INFO_USER</constant></entry>
|
||||
<entry>"user"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-password">
|
||||
<entry><constant>Win32_INFO_PASSWORD</constant></entry>
|
||||
<entry><constant>WIN32_INFO_PASSWORD</constant></entry>
|
||||
<entry>"password"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-path">
|
||||
<entry><constant>Win32_INFO_PATH</constant></entry>
|
||||
<entry><constant>WIN32_INFO_PATH</constant></entry>
|
||||
<entry>"path"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-params">
|
||||
<entry><constant>Win32_INFO_PARAMS</constant></entry>
|
||||
<entry><constant>WIN32_INFO_PARAMS</constant></entry>
|
||||
<entry>"params"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-description">
|
||||
<entry><constant>Win32_INFO_DESCRIPTION</constant></entry>
|
||||
<entry><constant>WIN32_INFO_DESCRIPTION</constant></entry>
|
||||
<entry>"description"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-start-type">
|
||||
<entry><constant>Win32_INFO_START_TYPE</constant></entry>
|
||||
<entry><constant>WIN32_INFO_START_TYPE</constant></entry>
|
||||
<entry>"start_type"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-load-order">
|
||||
<entry><constant>INFO_LOAD_ORDER</constant></entry>
|
||||
<entry>"load_order"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-svc-type">
|
||||
<entry><constant>INFO_SVC_TYPE</constant></entry>
|
||||
<entry>"svc_type"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-error-control">
|
||||
<entry><constant>INFO_ERROR_CONTROL</constant></entry>
|
||||
<entry>"error_control"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-delayed-start">
|
||||
<entry><constant>INFO_DELAYED_START</constant></entry>
|
||||
<entry>"delayed_start"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-base-priority">
|
||||
<entry><constant>INFO_BASE_PRIORITY</constant></entry>
|
||||
<entry>"base_priority"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-dependencies">
|
||||
<entry><constant>INFO_DEPENDENCIES</constant></entry>
|
||||
<entry>"dependencies"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-recovery-delay">
|
||||
<entry><constant>INFO_RECOVERY_DELAY</constant></entry>
|
||||
<entry>"recovery_delay"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-recovery-action-1">
|
||||
<entry><constant>INFO_RECOVERY_ACTION_1</constant></entry>
|
||||
<entry>"recovery_action_1"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-recovery-action-2">
|
||||
<entry><constant>INFO_RECOVERY_ACTION_2</constant></entry>
|
||||
<entry>"recovery_action_2"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-recovery-action-3">
|
||||
<entry><constant>INFO_RECOVERY_ACTION_3</constant></entry>
|
||||
<entry>"recovery_action_3"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-recovery-reset-period">
|
||||
<entry><constant>INFO_RECOVERY_RESET_PERIOD</constant></entry>
|
||||
<entry>"recovery_reset_period"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-recovery-enabled">
|
||||
<entry><constant>INFO_RECOVERY_ENABLED</constant></entry>
|
||||
<entry>"recovery_enabled"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-recovery-reboot-msg">
|
||||
<entry><constant>INFO_RECOVERY_REBOOT_MSG</constant></entry>
|
||||
<entry>"recovery_reboot_msg"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row xml:id="constant.win32-info-recovery-command">
|
||||
<entry><constant>INFO_RECOVERY_COMMAND</constant></entry>
|
||||
<entry>"recovery_command"</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<methodparam choice="opt"><type>string</type><parameter>machine</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Attempts to add a service into the SCM database. Administrative
|
||||
Attempts to add a service into the SCM database. Administrative
|
||||
privileges are required for this to succeed.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -168,6 +168,111 @@
|
|||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>dependencies</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
To define the dependencies for your service, it may be necessary to set
|
||||
this parameter to the list of the services names in an array.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>recovery_delay</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This parameter defines the delay between the fail and the execution
|
||||
of recovery action. The value is in milliseconds.
|
||||
</para>
|
||||
<para>
|
||||
The default value is 60000.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>recovery_action_1</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The action will be executed on first failure. The default value is
|
||||
<constant>WIN32_SC_ACTION_NONE</constant>.
|
||||
</para>
|
||||
<para>
|
||||
The <parameter>recovery_action_1</parameter> can be set to one of the
|
||||
constants defined in
|
||||
<link linkend="win32service.constants.recovery-action">Win32 Recovery action</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>recovery_action_2</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The action will be executed on second failure. The default value is
|
||||
<constant>WIN32_SC_ACTION_NONE</constant>.
|
||||
</para>
|
||||
<para>
|
||||
The <parameter>recovery_action_2</parameter> can be set to one of the
|
||||
constants defined in
|
||||
<link linkend="win32service.constants.recovery-action">Win32 Recovery action</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>recovery_action_3</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The action will be executed on next failures. The default value is
|
||||
<constant>WIN32_SC_ACTION_NONE</constant>.
|
||||
</para>
|
||||
<para>
|
||||
The <parameter>recovery_action_3</parameter> can be set to one of the
|
||||
constants defined in
|
||||
<link linkend="win32service.constants.recovery-action">Win32 Recovery action</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>recovery_reset_period</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The failure count will be reset after the delay defined in the parameter. The delay is expirement in seconds.
|
||||
</para>
|
||||
<para>
|
||||
The default value is <literal>86400</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>recovery_enabled</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Set this parameter at &true; to enable the recovery settings, &false;
|
||||
to disable.
|
||||
</para>
|
||||
<para>
|
||||
The default value is &false;
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>recovery_reboot_msg</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Set this parameter to define the message saved into the Windows Event
|
||||
Log before the reboot. Used only if one action is set to
|
||||
<constant>WIN32_SC_ACTION_REBOOT</constant>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>recovery_command</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Set this parameter to define the command executed when one action is defined on
|
||||
<constant>WIN32_SC_ACTION_RUN_COMMAND</constant>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -204,10 +309,61 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
$x = win32_create_service(array(
|
||||
'service' => 'dummyphp', # the name of your service
|
||||
'display' => 'sample dummy PHP service', # short description
|
||||
'description' => 'This is a dummy Windows service created using PHP.', # long description
|
||||
'params' => '"' . __FILE__ . '" run', # path to the script and parameters
|
||||
'service' => 'dummyphp', // the name of your service
|
||||
'display' => 'sample dummy PHP service', // short description
|
||||
'description' => 'This is a dummy Windows service created using PHP.', // long description
|
||||
'params' => '"' . __FILE__ . '" run', // path to the script and parameters
|
||||
));
|
||||
debug_zval_dump($x);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>win32_create_service</function> example with dependencies</title>
|
||||
<para>
|
||||
Create a service with the short name 'dummyphp' and dependencies.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$x = win32_create_service(array(
|
||||
'service' => 'dummyphp', // the name of your service
|
||||
'display' => 'sample dummy PHP service', // short description
|
||||
'description' => 'This is a dummy Windows service created using PHP.', // long description
|
||||
'params' => '"' . __FILE__ . '" run', // path to the script and parameters
|
||||
'dependencies' => array("Netman"), // The list of the dependencies
|
||||
));
|
||||
debug_zval_dump($x);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>win32_create_service</function> example with recovery</title>
|
||||
<para>
|
||||
Create a service with the short name 'dummyphp' and recovery settings.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$x = win32_create_service(array(
|
||||
'service' => 'dummyphp', // the name of your service
|
||||
'display' => 'sample dummy PHP service', // short description
|
||||
'description' => 'This is a dummy Windows service created using PHP.', // long description
|
||||
'params' => '"' . __FILE__ . '" run', // path to the script and parameters
|
||||
'recovery_delay' => 120000, // Recovery action is executed after 2 minutes
|
||||
'recovery_action_1' => WIN32_SC_ACTION_RESTART, // On first failure, restart the service
|
||||
'recovery_action_2' => WIN32_SC_ACTION_RUN_COMMAND, // On second failure, execute the commmand
|
||||
'recovery_action_3' => WIN32_SC_ACTION_NONE, // On other failure, do nothing
|
||||
'recovery_reset_period' => 86400, // Reset the fail counter after 1 day
|
||||
'recovery_enabled' => true, // Enable the recovery parameter
|
||||
'recovery_reboot_msg' => null, // Do not define a reboot message, it's not needed here
|
||||
'recovery_command' => "c:\clean-service.bat", // When the action is WIN32_SC_ACTION_RUN_COMMAND, execute this command
|
||||
));
|
||||
debug_zval_dump($x);
|
||||
?>
|
||||
|
@ -217,12 +373,37 @@ debug_zval_dump($x);
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="changelog"><!-- {{{ -->
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>0.4.0</entry>
|
||||
<entry>
|
||||
The <parameter>dependencies</parameter>, <parameter>recovery_delay</parameter>,<parameter>recovery_action_1</parameter>, <parameter>recovery_action_2</parameter>, <parameter>recovery_action_3</parameter>, <parameter>recovery_reset_period</parameter>, <parameter>recovery_enabled</parameter>, <parameter>recovery_reboot_msg</parameter> and <parameter>recovery_command</parameter> parameters have been added.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1><!-- }}} -->
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>win32_delete_service</function></member>
|
||||
<member><link linkend="win32service.constants.basepriorities">Win32 Base Priority Classes</link></member>
|
||||
<member><link linkend="win32service.constants.recovery-action">Win32 Recovery action</link></member>
|
||||
<member><link linkend="win32service.constants.errors">Win32 Error Codes</link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<constant>WIN32_ERROR_SERVICE_SPECIFIC_ERROR</constant>
|
||||
if the exit mode is not gracefuly. See
|
||||
<link linkend="win32service.constants.errors">Win32Service error codes</link> and
|
||||
<link linkend="function.win32-set-service-exit-mode"><function>win32_set_service_exit_mode</function></link>
|
||||
<function>win32_set_service_exit_mode</function>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -93,7 +93,7 @@
|
|||
<para>
|
||||
If the service exited with an error condition, the service specific
|
||||
code that is logged in the event log is visible here. This value is equal
|
||||
to the value defined by <link linkend="function.win32-set-service-exit-code"><function>win32_set_service_exit_code</function></link>
|
||||
to the value defined by <function>win32_set_service_exit_code</function>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -122,7 +122,7 @@
|
|||
<term><parameter>ProcessId</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The Windows process identifier. If 0, the process is not running.
|
||||
The Windows process identifier. If 0, the process is not running.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
Loading…
Reference in a new issue