downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.win32-create-service.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.win32service.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.win32-create-service.php',
   
1 => 'win32_create_service',
  ),
 
'up' =>
  array (
   
0 => 'ref.win32service.php',
   
1 => 'win32service Functions',
  ),
 
'prev' =>
  array (
   
0 => 'ref.win32service.php',
   
1 => 'win32service Functions',
  ),
 
'next' =>
  array (
   
0 => 'function.win32-delete-service.php',
   
1 => 'win32_delete_service',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.win32-create-service" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">win32_create_service</h1>
  <p class="verinfo">(PECL win32service SVN)</p><p class="refpurpose"><span class="refname">win32_create_service</span> &mdash; <span class="dc-title">Creates a new service entry in the SCM database</span></p>

 </div>
 <a name="function.win32-create-service.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="language.pseudo-types.php#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b>win32_create_service</b></span>
    ( <span class="methodparam"><span class="type">array</span> <tt class="parameter">$details</tt></span>
   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$machine</tt></span>
  ] )</div>

 </div>

 <a name="function.win32-create-service.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">details</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       An array of service details:
       </p><dl>

        <dt class="varlistentry">

         <br /><span class="term"><i><tt class="parameter">service</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           The short name of the service.  This is the name that you
           will use to control the service using the <i>net</i>
           command.  The service must be unique (no two services can share the
           same name), and, ideally, should avoid having spaces in the name.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">display</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">The display name of the service.  This is the name that you
          will see in the Services Applet.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">user</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           The name of the user account under which you want the service to
           run.  If omitted, the service will run as the LocalSystem account.
           If the username is specified, you must also provide a password.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">password</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           The password that corresponds to the <i><tt class="parameter">user</tt></i>
.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">path</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           The full path to the executable module that will be launched when
           the service is started.  If omitted, the path to the current PHP
           process will be used.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">params</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           Command line parameters to pass to the service when it starts.
           If you want to run a PHP script as the service, then the first
           parameter should be the full path to the PHP script that you intend
           to run.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">load_order</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           Controls the load_order.  This is not yet fully supported.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">svc_type</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           Sets the service type.  If omitted, the default value is
           <b><tt class="constant">WIN32_SERVICE_WIN32_OWN_PROCESS</tt></b>.
           Don&#039;t change this unless you know what you&#039;re doing.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">start_type</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           Specifies how the service should be started.  The default is
           <b><tt class="constant">WIN32_SERVICE_AUTO_START</tt></b> which means the
           service will be launched when the machine starts up.
          </p>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">error_control</tt></i>
</span>

         </dt><dd class="listitem">

          <p class="para">
           Informs the SCM what it should do when it detects a problem with
           the service.  The default is
           <b><tt class="constant">WIN32_SERVER_ERROR_IGNORE</tt></b>.  Changing this
           value is not yet fully supported.
          </p>
         </dd>

       
       </dl>
<p>
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">machine</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The optional machine name on which you want to create a service.
       If omitted, it will use the local machine.
      </p>
     </dd>

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

 <a name="function.win32-create-service.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <b><tt class="constant">TRUE</tt></b> on success, otherwise returns a win32 error code.
  </p>
 </div>


 <a name="function.win32-create-service.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 A <b>win32_create_service()</b> example</b></p>
    <div class="example-contents para"><p>
     Any text that describes the purpose of the example, or
     what goes on in the example should go here (inside the
    </p><div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$x&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">win32_create_service</span><span style="color: #007700">(array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'service'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'dummyphp'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'display'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'sample&nbsp;dummy&nbsp;PHP&nbsp;service'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'params'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">__FILE__&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'&nbsp;run'</span><span style="color: #007700">,<br />));<br /></span><span style="color: #0000BB">debug_zval_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>
<p>
    </p></div>
   </div><p>
  </p>
 </div>



 <a name="function.win32-create-service.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.win32-delete-service.php" class="function" rel="rdfs-seeAlso">win32_delete_service()</a> - Deletes a service entry from the SCM database</li>
   </ul><p>
  </p>
 </div>



</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites