PHP: win32_create_service - Manual

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

search for in the

win32_delete_service win32service

Last updated: Sat, 27 Jan 2007

view this page in

# win32_create_service

(PECL)

win32_create_service -- Creates a new service entry in the SCM database

## Описание

int win32_create_service ( array details [, string machine] )

## Список параметров

`details`

  An array of service details:

  `service`

    The short name of the service. This is the name that you will use to control the service using the `net` command. The service must be unique (no two services can share the same name), and, ideally, should avoid having spaces in the name.

  `display`

    The display name of the service. This is the name that you will see in the Services Applet.

  `user`

    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.

  `password`

    The password that corresponds to the `user`.

  `path`

    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.

  `params`

    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.

  `load_order`

    Controls the load_order. This is not yet fully supported.

  `svc_type`

    Sets the service type. If omitted, the default value is `WIN32_SERVICE_WIN32_OWN_PROCESS`. Don't change this unless you know what you're doing.

  `start_type`

    Specifies how the service should be started. The default is `WIN32_SERVICE_AUTO_START` which means the the service will be launched when the machine starts up.

  `error_control`

    Informs the SCM what it should do when it detects a problem with the service. The default is `WIN32_SERVER_ERROR_IGNORE`. Changing this value is not yet fully supported.

`machine`

  The optional machine name on which you want to create a service. If omitted, it will use the local machine.

## Возвращаемые значения

Returns `TRUE` on success, otherwise returns a win32 error code.

## Примеры

Пример 1. A win32_create_service() example

Any text that describes the purpose of the example, or what goes on in the example should go here (inside the

`<?php
$x = win32_create_service(array(
'service' => 'dummyphp',
'display' => 'sample dummy PHP service',
'params' => __FILE__ . ' run',
));
debug_zval_dump($x);
?>`

## Смотрите также

win32_delete_service()

add a note User Contributed Notes
win32_create_service
pauljamesthomson at gmail dot com
22-Jan-2007 04:54
`Other start_type values:
0x00000002: A service started automatically by the service control manager during system startup. For more information, see Automatically Starting Services.
0x00000000: A device driver started by the system loader. This value is valid only for driver services.
0x00000003: A service started by the service control manager when a process calls the win32_start_service() function.
0x00000004: A service that cannot be started. Attempts to start the service result in the error code
0x00000001: A device driver started by the IoInitSystem function. This value is valid only for driver services.
I can confirm that 0x00000003 works as expected (service is created, but must be started manually).
More here:
http://msdn2.microsoft.com/en-us/library/ms682450.aspx`
add a note
win32_delete_service win32service

Last updated: Sat, 27 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 11:33:19 2007 PST