note 76421 added to function.win32-start-service-ctrl-dispatcher

From: Date: Sat, 14 Jul 2007 14:59:29 +0000
Subject: note 76421 added to function.win32-start-service-ctrl-dispatcher
Groups: php.notes 
Request: Send a blank email to php-notes+get-128517@lists.php.net to get a copy of this message
<?php // First you need to create a service, you only need to do this once /* win32_create_service(array( 'service' => 'myphpservice', 'display' => 'My PHP Service', 'params' => 'c:\\myphpservice.php', 'path' => 'c:\\PHP\\php.exe')); */ $myservicename = 'myphpservice'; // Connect to service dispatcher and notify that startup was successful if (!win32_start_service_ctrl_dispatcher($myservicename)) die('Could not connect to service :'.$myservicename); win32_set_service_status(WIN32_SERVICE_RUNNING); // Main Server Loop while (1) { switch (win32_get_last_control_message()) { case WIN32_SERVICE_CONTROL_CONTINUE: break; // Continue server routine case WIN32_SERVICE_CONTROL_INTERROGATE: win32_set_service_status(WIN32_NO_ERROR); break; // Respond with status case WIN32_SERVICE_CONTROL_STOP: win32_set_service_status(WIN32_SERVICE_STOPPED); exit; // Terminate script default: win32_set_service_status(WIN32_ERROR_CALL_NOT_IMPLEMENTED); // Add more cases to handle other service calls } // Main script goes here sleep(10); // Run every 10 seconds } win32_set_service_status(WIN32_SERVICE_STOPPED); ?> ---- Server IP: 216.235.15.211 Probable Submitter: 156.34.12.173 ---- Manual Page -- http://www.php.net/manual/en/function.win32-start-service-ctrl-dispatcher.php Edit -- https://master.php.net/note/edit/76421 Del: integrated -- https://master.php.net/note/delete/76421/integrated Del: useless -- https://master.php.net/note/delete/76421/useless Del: bad code -- https://master.php.net/note/delete/76421/bad+code Del: spam -- https://master.php.net/note/delete/76421/spam Del: non-english -- https://master.php.net/note/delete/76421/non-english Del: in docs -- https://master.php.net/note/delete/76421/in+docs Del: other reasons-- https://master.php.net/note/delete/76421 Reject -- https://master.php.net/note/reject/76421 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128517) next »