@@ -610,7 +610,7 @@ static int sapi_lsapi_activate()
610610static sapi_module_struct lsapi_sapi_module =
611611{
612612 "litespeed" ,
613- "LiteSpeed V7.5 " ,
613+ "LiteSpeed V7.6 " ,
614614
615615 php_lsapi_startup , /* startup */
616616 php_module_shutdown_wrapper , /* shutdown */
@@ -691,6 +691,8 @@ static void lsapi_sigsegv( int signal )
691691 _exit (1 );
692692}
693693
694+ static int do_clean_shutdown = 1 ;
695+
694696static int clean_onexit = 1 ;
695697
696698
@@ -766,18 +768,20 @@ static int lsapi_module_main(int show_source)
766768 return -1 ;
767769 }
768770
769- sigemptyset (& act .sa_mask );
770- act .sa_flags = SA_NODEFER ;
771- act .sa_handler = lsapi_sigterm ;
772- sa_rc = sigaction ( SIGINT , & act , NULL );
773- sa_rc = sigaction ( SIGQUIT , & act , NULL );
774- sa_rc = sigaction ( SIGILL , & act , NULL );
775- sa_rc = sigaction ( SIGABRT , & act , NULL );
776- sa_rc = sigaction ( SIGBUS , & act , NULL );
777- sa_rc = sigaction ( SIGSEGV , & act , NULL );
778- sa_rc = sigaction ( SIGTERM , & act , NULL );
779-
780- clean_onexit = 0 ;
771+ if (do_clean_shutdown ) {
772+ sigemptyset (& act .sa_mask );
773+ act .sa_flags = SA_NODEFER ;
774+ act .sa_handler = lsapi_sigterm ;
775+ sa_rc = sigaction ( SIGINT , & act , NULL );
776+ sa_rc = sigaction ( SIGQUIT , & act , NULL );
777+ sa_rc = sigaction ( SIGILL , & act , NULL );
778+ sa_rc = sigaction ( SIGABRT , & act , NULL );
779+ sa_rc = sigaction ( SIGBUS , & act , NULL );
780+ sa_rc = sigaction ( SIGSEGV , & act , NULL );
781+ sa_rc = sigaction ( SIGTERM , & act , NULL );
782+
783+ clean_onexit = 0 ;
784+ }
781785
782786 if (show_source ) {
783787 zend_syntax_highlighter_ini syntax_highlighter_ini ;
@@ -1585,7 +1589,8 @@ int main( int argc, char * argv[] )
15851589
15861590 int result ;
15871591
1588- atexit (lsapi_atexit );
1592+ if (do_clean_shutdown )
1593+ atexit (lsapi_atexit );
15891594
15901595 while ( ( result = LSAPI_Prefork_Accept_r ( & g_req )) >= 0 ) {
15911596#if defined(linux ) || defined(__linux ) || defined(__linux__ ) || defined(__gnu_linux__ )
@@ -1659,6 +1664,13 @@ static PHP_MINIT_FUNCTION(litespeed)
16591664 if (p && 0 == strcasecmp (p , "on" ))
16601665 parse_user_ini = 1 ;
16611666
1667+ p = getenv ("LSAPI_CLEAN_SHUTDOWN" );
1668+ if (p ) {
1669+ if (* p == '1' || 0 == strcasecmp (p , "on" ))
1670+ do_clean_shutdown = 1 ;
1671+ else if (* p == '0' || 0 == strcasecmp (p , "off" ))
1672+ do_clean_shutdown = 0 ;
1673+ }
16621674 /*
16631675 * mod_lsapi always sets this env var,
16641676 * so we can detect mod_lsapi mode with its presense.
0 commit comments