@@ -621,7 +621,7 @@ static int sapi_lsapi_activate()
621621static sapi_module_struct lsapi_sapi_module =
622622{
623623 "litespeed" ,
624- "LiteSpeed V7.5 " ,
624+ "LiteSpeed V7.6 " ,
625625
626626 php_lsapi_startup , /* startup */
627627 php_module_shutdown_wrapper , /* shutdown */
@@ -702,6 +702,8 @@ static void lsapi_sigsegv( int signal )
702702 _exit (1 );
703703}
704704
705+ static int do_clean_shutdown = 1 ;
706+
705707static int clean_onexit = 1 ;
706708
707709
@@ -777,18 +779,20 @@ static int lsapi_module_main(int show_source)
777779 return -1 ;
778780 }
779781
780- sigemptyset (& act .sa_mask );
781- act .sa_flags = SA_NODEFER ;
782- act .sa_handler = lsapi_sigterm ;
783- sa_rc = sigaction ( SIGINT , & act , NULL );
784- sa_rc = sigaction ( SIGQUIT , & act , NULL );
785- sa_rc = sigaction ( SIGILL , & act , NULL );
786- sa_rc = sigaction ( SIGABRT , & act , NULL );
787- sa_rc = sigaction ( SIGBUS , & act , NULL );
788- sa_rc = sigaction ( SIGSEGV , & act , NULL );
789- sa_rc = sigaction ( SIGTERM , & act , NULL );
790-
791- clean_onexit = 0 ;
782+ if (do_clean_shutdown ) {
783+ sigemptyset (& act .sa_mask );
784+ act .sa_flags = SA_NODEFER ;
785+ act .sa_handler = lsapi_sigterm ;
786+ sa_rc = sigaction ( SIGINT , & act , NULL );
787+ sa_rc = sigaction ( SIGQUIT , & act , NULL );
788+ sa_rc = sigaction ( SIGILL , & act , NULL );
789+ sa_rc = sigaction ( SIGABRT , & act , NULL );
790+ sa_rc = sigaction ( SIGBUS , & act , NULL );
791+ sa_rc = sigaction ( SIGSEGV , & act , NULL );
792+ sa_rc = sigaction ( SIGTERM , & act , NULL );
793+
794+ clean_onexit = 0 ;
795+ }
792796
793797 if (show_source ) {
794798 zend_syntax_highlighter_ini syntax_highlighter_ini ;
@@ -1601,7 +1605,8 @@ int main( int argc, char * argv[] )
16011605 int iRequestsProcessed = 0 ;
16021606 int result ;
16031607
1604- atexit (lsapi_atexit );
1608+ if (do_clean_shutdown )
1609+ atexit (lsapi_atexit );
16051610
16061611 while ( ( result = LSAPI_Prefork_Accept_r ( & g_req )) >= 0 ) {
16071612#if defined(linux ) || defined(__linux ) || defined(__linux__ ) || defined(__gnu_linux__ )
@@ -1675,6 +1680,13 @@ static PHP_MINIT_FUNCTION(litespeed)
16751680 if (p && 0 == strcasecmp (p , "on" ))
16761681 parse_user_ini = 1 ;
16771682
1683+ p = getenv ("LSAPI_CLEAN_SHUTDOWN" );
1684+ if (p ) {
1685+ if (* p == '1' || 0 == strcasecmp (p , "on" ))
1686+ do_clean_shutdown = 1 ;
1687+ else if (* p == '0' || 0 == strcasecmp (p , "off" ))
1688+ do_clean_shutdown = 0 ;
1689+ }
16781690 /*
16791691 * mod_lsapi always sets this env var,
16801692 * so we can detect mod_lsapi mode with its presense.
0 commit comments