@@ -601,7 +601,7 @@ static int sapi_lsapi_activate()
601
601
static sapi_module_struct lsapi_sapi_module =
602
602
{
603
603
"litespeed" ,
604
- "LiteSpeed V7.5 " ,
604
+ "LiteSpeed V7.6 " ,
605
605
606
606
php_lsapi_startup , /* startup */
607
607
php_module_shutdown_wrapper , /* shutdown */
@@ -678,6 +678,8 @@ static void lsapi_sigsegv( int signal )
678
678
_exit (1 );
679
679
}
680
680
681
+ static int do_clean_shutdown = 1 ;
682
+
681
683
static int clean_onexit = 1 ;
682
684
683
685
@@ -753,18 +755,20 @@ static int lsapi_module_main(int show_source)
753
755
return -1 ;
754
756
}
755
757
756
- sigemptyset (& act .sa_mask );
757
- act .sa_flags = SA_NODEFER ;
758
- act .sa_handler = lsapi_sigterm ;
759
- sa_rc = sigaction ( SIGINT , & act , NULL );
760
- sa_rc = sigaction ( SIGQUIT , & act , NULL );
761
- sa_rc = sigaction ( SIGILL , & act , NULL );
762
- sa_rc = sigaction ( SIGABRT , & act , NULL );
763
- sa_rc = sigaction ( SIGBUS , & act , NULL );
764
- sa_rc = sigaction ( SIGSEGV , & act , NULL );
765
- sa_rc = sigaction ( SIGTERM , & act , NULL );
766
-
767
- clean_onexit = 0 ;
758
+ if (do_clean_shutdown ) {
759
+ sigemptyset (& act .sa_mask );
760
+ act .sa_flags = SA_NODEFER ;
761
+ act .sa_handler = lsapi_sigterm ;
762
+ sa_rc = sigaction ( SIGINT , & act , NULL );
763
+ sa_rc = sigaction ( SIGQUIT , & act , NULL );
764
+ sa_rc = sigaction ( SIGILL , & act , NULL );
765
+ sa_rc = sigaction ( SIGABRT , & act , NULL );
766
+ sa_rc = sigaction ( SIGBUS , & act , NULL );
767
+ sa_rc = sigaction ( SIGSEGV , & act , NULL );
768
+ sa_rc = sigaction ( SIGTERM , & act , NULL );
769
+
770
+ clean_onexit = 0 ;
771
+ }
768
772
769
773
if (show_source ) {
770
774
zend_syntax_highlighter_ini syntax_highlighter_ini ;
@@ -1567,7 +1571,8 @@ int main( int argc, char * argv[] )
1567
1571
1568
1572
int result ;
1569
1573
1570
- atexit (lsapi_atexit );
1574
+ if (do_clean_shutdown )
1575
+ atexit (lsapi_atexit );
1571
1576
1572
1577
while ( ( result = LSAPI_Prefork_Accept_r ( & g_req )) >= 0 ) {
1573
1578
#if defined(linux ) || defined(__linux ) || defined(__linux__ ) || defined(__gnu_linux__ )
@@ -1641,6 +1646,13 @@ static PHP_MINIT_FUNCTION(litespeed)
1641
1646
if (p && 0 == strcasecmp (p , "on" ))
1642
1647
parse_user_ini = 1 ;
1643
1648
1649
+ p = getenv ("LSAPI_CLEAN_SHUTDOWN" );
1650
+ if (p ) {
1651
+ if (* p == '1' || 0 == strcasecmp (p , "on" ))
1652
+ do_clean_shutdown = 1 ;
1653
+ else if (* p == '0' || 0 == strcasecmp (p , "off" ))
1654
+ do_clean_shutdown = 0 ;
1655
+ }
1644
1656
/*
1645
1657
* mod_lsapi always sets this env var,
1646
1658
* so we can detect mod_lsapi mode with its presense.
0 commit comments