Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 6569

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Registers the script with the SCM, so that it can act as the service with the given name</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.win32-set-service-status.html">win32_set_service_status</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.win32-start-service.html">win32_start_service</a></div>
 <div class="up"><a href="ref.win32service.html">win32service Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.win32-start-service-ctrl-dispatcher" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">win32_start_service_ctrl_dispatcher</h1>
  <p class="verinfo">(PECL win32service SVN)</p><p class="refpurpose"><span class="refname">win32_start_service_ctrl_dispatcher</span> &mdash; <span class="dc-title">Registers the script with the SCM, so that it can act as the service with the given name</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.win32-start-service-ctrl-dispatcher-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>win32_start_service_ctrl_dispatcher</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   )</div>


  <p class="para rdfs-comment">
   When launched via the Service Control Manager, a service process is
   required to &quot;check-in&quot; with it to establish service monitoring and
   communication facilities.  This function performs the check-in by spawning
   a thread to handle the lower-level communication with the service control
   manager.
  </p>
  <p class="para">
   Once started, the service process should do 2 things. The first is to tell
   the Service Control Manager that the service is running. This is achieved
   by calling  <span class="function"><a href="function.win32-set-service-status.html" class="function">win32_set_service_status()</a></span> with the
   <strong><code>WIN32_SERVICE_RUNNING</code></strong> constant. If you need to perform
   some lengthy process before the service is actually running, then you can
   use the <strong><code>WIN32_SERVICE_START_PENDING</code></strong> constant. The
   second is to continue to check-in with the service control manager so that
   it can determine if it should terminate. This is achieved by periodically
   calling  <span class="function"><a href="function.win32-get-last-control-message.html" class="function">win32_get_last_control_message()</a></span> and handling the
   return code appropriately.
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.win32-start-service-ctrl-dispatcher-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">name</code></em></span>
     <dd>

      <p class="para">
       The short-name of the service, as registered by
        <span class="function"><a href="function.win32-create-service.html" class="function">win32_create_service()</a></span>.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.win32-start-service-ctrl-dispatcher-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success, <strong><code>FALSE</code></strong> if there is a problem with the parameters or a <a href="win32service.constants.errors.html" class="link">Win32 Error Code</a> on failure.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.win32-start-service-ctrl-dispatcher-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-5392">
    <p><strong>Example #1 A  <span class="function"><strong>win32_start_service_ctrl_dispatcher()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     Check if the service is runnig under the SCM.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">win32_start_service_ctrl_dispatcher</span><span style="color: #007700">(</span><span style="color: #DD0000">'dummyphp'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;die(</span><span style="color: #DD0000">"I'm&nbsp;probably&nbsp;not&nbsp;running&nbsp;under&nbsp;the&nbsp;service&nbsp;control&nbsp;manager"</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">win32_set_service_status</span><span style="color: #007700">(</span><span style="color: #0000BB">WIN32_SERVICE_START_PENDING</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Some&nbsp;lengthy&nbsp;process&nbsp;to&nbsp;get&nbsp;this&nbsp;service&nbsp;up&nbsp;and&nbsp;running.<br /><br /></span><span style="color: #0000BB">win32_set_service_status</span><span style="color: #007700">(</span><span style="color: #0000BB">WIN32_SERVICE_RUNNING</span><span style="color: #007700">);<br /><br />while&nbsp;(</span><span style="color: #0000BB">WIN32_SERVICE_CONTROL_STOP&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #0000BB">win32_get_last_control_message</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">#&nbsp;do&nbsp;some&nbsp;work&nbsp;here,&nbsp;trying&nbsp;not&nbsp;to&nbsp;take&nbsp;more&nbsp;than&nbsp;around&nbsp;30&nbsp;seconds<br />&nbsp;&nbsp;#&nbsp;before&nbsp;coming&nbsp;back&nbsp;into&nbsp;the&nbsp;loop&nbsp;again<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.win32-start-service-ctrl-dispatcher-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.win32-set-service-status.html" class="function" rel="rdfs-seeAlso">win32_set_service_status()</a> - Update the service status</span></li>
    <li class="member"> <span class="function"><a href="function.win32-get-last-control-message.html" class="function" rel="rdfs-seeAlso">win32_get_last_control_message()</a> - Returns the last control message that was sent to this service</span></li>
    <li class="member"><a href="win32service.constants.errors.html" class="link">Win32 Error Codes</a></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.win32-set-service-status.html">win32_set_service_status</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.win32-start-service.html">win32_start_service</a></div>
 <div class="up"><a href="ref.win32service.html">win32service Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>