@@ -621,7 +621,7 @@ static int sapi_lsapi_activate()
621
621
static sapi_module_struct lsapi_sapi_module =
622
622
{
623
623
"litespeed" ,
624
- "LiteSpeed V7.5 " ,
624
+ "LiteSpeed V7.6 " ,
625
625
626
626
php_lsapi_startup , /* startup */
627
627
php_module_shutdown_wrapper , /* shutdown */
@@ -702,6 +702,8 @@ static void lsapi_sigsegv( int signal )
702
702
_exit (1 );
703
703
}
704
704
705
+ static int do_clean_shutdown = 1 ;
706
+
705
707
static int clean_onexit = 1 ;
706
708
707
709
@@ -777,18 +779,20 @@ static int lsapi_module_main(int show_source)
777
779
return -1 ;
778
780
}
779
781
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
+ }
792
796
793
797
if (show_source ) {
794
798
zend_syntax_highlighter_ini syntax_highlighter_ini ;
@@ -1601,7 +1605,8 @@ int main( int argc, char * argv[] )
1601
1605
int iRequestsProcessed = 0 ;
1602
1606
int result ;
1603
1607
1604
- atexit (lsapi_atexit );
1608
+ if (do_clean_shutdown )
1609
+ atexit (lsapi_atexit );
1605
1610
1606
1611
while ( ( result = LSAPI_Prefork_Accept_r ( & g_req )) >= 0 ) {
1607
1612
#if defined(linux ) || defined(__linux ) || defined(__linux__ ) || defined(__gnu_linux__ )
@@ -1675,6 +1680,13 @@ static PHP_MINIT_FUNCTION(litespeed)
1675
1680
if (p && 0 == strcasecmp (p , "on" ))
1676
1681
parse_user_ini = 1 ;
1677
1682
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
+ }
1678
1690
/*
1679
1691
* mod_lsapi always sets this env var,
1680
1692
* so we can detect mod_lsapi mode with its presense.
0 commit comments