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