@@ -610,7 +610,7 @@ static int sapi_lsapi_activate()
610
610
static sapi_module_struct lsapi_sapi_module =
611
611
{
612
612
"litespeed" ,
613
- "LiteSpeed V7.5 " ,
613
+ "LiteSpeed V7.6 " ,
614
614
615
615
php_lsapi_startup , /* startup */
616
616
php_module_shutdown_wrapper , /* shutdown */
@@ -691,6 +691,8 @@ static void lsapi_sigsegv( int signal )
691
691
_exit (1 );
692
692
}
693
693
694
+ static int do_clean_shutdown = 1 ;
695
+
694
696
static int clean_onexit = 1 ;
695
697
696
698
@@ -766,18 +768,20 @@ static int lsapi_module_main(int show_source)
766
768
return -1 ;
767
769
}
768
770
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
+ }
781
785
782
786
if (show_source ) {
783
787
zend_syntax_highlighter_ini syntax_highlighter_ini ;
@@ -1585,7 +1589,8 @@ int main( int argc, char * argv[] )
1585
1589
1586
1590
int result ;
1587
1591
1588
- atexit (lsapi_atexit );
1592
+ if (do_clean_shutdown )
1593
+ atexit (lsapi_atexit );
1589
1594
1590
1595
while ( ( result = LSAPI_Prefork_Accept_r ( & g_req )) >= 0 ) {
1591
1596
#if defined(linux ) || defined(__linux ) || defined(__linux__ ) || defined(__gnu_linux__ )
@@ -1659,6 +1664,13 @@ static PHP_MINIT_FUNCTION(litespeed)
1659
1664
if (p && 0 == strcasecmp (p , "on" ))
1660
1665
parse_user_ini = 1 ;
1661
1666
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
+ }
1662
1674
/*
1663
1675
* mod_lsapi always sets this env var,
1664
1676
* so we can detect mod_lsapi mode with its presense.
0 commit comments