1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- Purpose: utilspec.windows -->
<!-- Membership: pecl -->
<reference id="ref.win32service">
<title>win32service Functions</title>
<titleabbrev>win32service</titleabbrev>
<partintro>
<section id="win32service.intro">
&reftitle.intro;
<para>
The win32service extension is a Windows specific extension that allows PHP
to communicate with the Service Control Manager to start, stop, register
and unregister services, and even allows your PHP scripts to run as a
service.
</para>
</section>
<section id="win32service.requirements">
&reftitle.required;
<para>
Windows NT, Windows 2000, Windows XP or Windows Server 2003. Any version
of windows derived from Windows NT should be compatible.
</para>
</section>
<section id="win32service.install">
&reftitle.install;
<procedure id="win32service.install-from-pecl">
<title>Installing from PECL</title>
<step>
<para>
You can download php_win32service.dll from http://snaps.php.net/win32/.
Choose the PECL_X_X folder that matches you PHP version.
</para>
</step>
<step>
<para>
Copy the php_win32service.dll into your <link
linkend="ini.extension-dir">extension_dir</link>.
</para>
</step>
<step>
<para>
Load the extension from your &php.ini;
<screen>
<![CDATA[
extension=php_win32service.dll
]]>
</screen>
</para>
</step>
</procedure>
</section>
<section id="win32service.examples">
&reftitle.examples;
<para>
<example>
<title>Registering a PHP script to run as a service</title>
<programlisting role='php'>
<![CDATA[
<?php
win32_create_service(array(
'service' => 'dummyphp', # the name of your service
'display' => 'sample dummy PHP service', # description
'params' => 'c:\path\to\script.php run', # path to the script and parameters
));
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Unregistering a service</title>
<programlisting role='php'>
<![CDATA[
<?php
win32_delete_service('dummyphp');
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Running as a service</title>
<programlisting role='php'>
<![CDATA[
<?php
if ($argv[1] == 'run') {
win32_start_service_ctrl_dispatcher('dummyphp');
while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {
# do your work here.
# try not to take up more than 30 seconds before going around the loop
# again
}
}
?>
]]>
</programlisting>
</example>
</para>
</section>
&reference.win32service.constants;
</partintro>
&reference.win32service.functions;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|