|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patcheswin32service.tfmGracefulExit_php5.5.patch (last revision 2015-03-03 15:20 UTC by tfm-phpnet at earth dot li)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-03-05 21:07 UTC] rquadling@php.net
[2015-04-24 03:20 UTC] minh at flowconnect dot com
[2017-05-02 21:11 UTC] jean-baptiste at nahan dot fr
[2019-01-03 06:30 UTC] jbnahan@php.net
-Assigned To:
+Assigned To: jbnahan
[2019-01-03 06:33 UTC] jbnahan@php.net
[2019-01-03 06:33 UTC] jbnahan@php.net
-Status: Assigned
+Status: Closed
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 14:00:01 2025 UTC |
Description: ------------ If the PHP script dies during execution then the PHP_RSHUTDOWN_FUNCTION reports that the service has STOPPED in the normal way with: SVCG(st).dwCurrentState = SERVICE_STOPPED; SetServiceStatus(SVCG(sh), &SVCG(st)); This means that the builtin windows service recovery options such as "Restart the Service" do not fire (because the exit is not considered to be a failure). I have made a patch (which I've been using without issues for a couple of years) which allows you to configure for an ungraceful exit by either passing an extra optional parameter to win32_start_service_ctrl_dispatcher or calling this function: /* {{{ proto bool win32_set_service_exit_mode(bool gracefulExit) Set (and get) the exit mode of the service, when set to true the service will shut down gracefuly when PHP exits, when set to false it will not shut down gracefuly, this will mean that the service will count as having failed and the recovery action will be run */ static PHP_FUNCTION(win32_set_service_exit_mode) If your service wants to exit cleanly it can call win32_set_service_exit_mode(true) to tell it that the shutdown should be clean.