📄 function.win32-create-service.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Creates a new service entry in the SCM database</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.win32service.html">win32service Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.win32-delete-service.html">win32_delete_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-create-service" class="refentry"> <div class="refnamediv"> <h1 class="refname">win32_create_service</h1> <p class="verinfo">(No version information available, might be only in CVS)</p><p class="refpurpose"><span class="refname">win32_create_service</span> — <span class="dc-title">Creates a new service entry in the SCM database</span></p> </div> <div class="refsect1 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"><b><b>win32_create_service</b></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> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">details</tt></i></span> <dd> <p class="para"> An array of service details: <dl> <dt> <br /><span class="term"><i><tt class="parameter">service</tt></i></span> <dd> <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> <dt> <span class="term"><i><tt class="parameter">display</tt></i></span> <dd> <p class="para">The display name of the service. This is the name that you will see in the Services Applet. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">user</tt></i></span> <dd> <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> <dt> <span class="term"><i><tt class="parameter">password</tt></i></span> <dd> <p class="para"> The password that corresponds to the <i><tt class="parameter">user</tt></i>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">path</tt></i></span> <dd> <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> <dt> <span class="term"><i><tt class="parameter">params</tt></i></span> <dd> <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> <dt> <span class="term"><i><tt class="parameter">load_order</tt></i></span> <dd> <p class="para"> Controls the load_order. This is not yet fully supported. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">svc_type</tt></i></span> <dd> <p class="para"> Sets the service type. If omitted, the default value is <b><tt>WIN32_SERVICE_WIN32_OWN_PROCESS</tt></b>. Don't change this unless you know what you're doing. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">start_type</tt></i></span> <dd> <p class="para"> Specifies how the service should be started. The default is <b><tt>WIN32_SERVICE_AUTO_START</tt></b> which means the the service will be launched when the machine starts up. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">error_control</tt></i></span> <dd> <p class="para"> Informs the SCM what it should do when it detects a problem with the service. The default is <b><tt>WIN32_SERVER_ERROR_IGNORE</tt></b>. Changing this value is not yet fully supported. </p> </dd> </dt> </dl> </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">machine</tt></i></span> <dd> <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> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <b><tt>TRUE</tt></b> on success, otherwise returns a win32 error code. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 A <b>win32_create_service()</b> example</b></p> <div class="example-contents"><p> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$x </span><span style="color: #007700">= </span><span style="color: #0000BB">win32_create_service</span><span style="color: #007700">(array(<br /> </span><span style="color: #DD0000">'service' </span><span style="color: #007700">=> </span><span style="color: #DD0000">'dummyphp'</span><span style="color: #007700">,<br /> </span><span style="color: #DD0000">'display' </span><span style="color: #007700">=> </span><span style="color: #DD0000">'sample dummy PHP service'</span><span style="color: #007700">,<br /> </span><span style="color: #DD0000">'params' </span><span style="color: #007700">=> </span><span style="color: #0000BB">__FILE__ </span><span style="color: #007700">. </span><span style="color: #DD0000">' 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">?></span></span></code></div> </div> </p></div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.win32-delete-service.html" class="function" rel="rdfs-seeAlso">win32_delete_service()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.win32service.html">win32service Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.win32-delete-service.html">win32_delete_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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -