summaryrefslogtreecommitdiff
path: root/sapi/litespeed
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/litespeed')
-rw-r--r--sapi/litespeed/README.md299
-rw-r--r--sapi/litespeed/config.m46
-rw-r--r--sapi/litespeed/lsapi_main.c33
-rw-r--r--sapi/litespeed/lsapidef.h2
-rw-r--r--sapi/litespeed/lsapilib.c6
-rw-r--r--sapi/litespeed/lsapilib.h2
-rw-r--r--sapi/litespeed/lscriu.c11
-rw-r--r--sapi/litespeed/lscriu.h2
8 files changed, 164 insertions, 197 deletions
diff --git a/sapi/litespeed/README.md b/sapi/litespeed/README.md
index 3f5b7ad14f..e98a940b3d 100644
--- a/sapi/litespeed/README.md
+++ b/sapi/litespeed/README.md
@@ -1,221 +1,204 @@
-Introduction
-============
+# Introduction
LiteSpeed SAPI module is a dedicated interface for PHP integration with
-LiteSpeed Web Server. LiteSpeed SAPI has similar architecture to the
-FastCGI SAPI with there major enhancements: better performance, dynamic
-spawning and PHP configuration modification through web server
-configuration and .htaccess files.
+LiteSpeed Web Server. LiteSpeed SAPI has similar architecture to the FastCGI
+SAPI with there major enhancements: better performance, dynamic spawning and PHP
+configuration modification through web server configuration and `.htaccess`
+files.
-Our simple benchmark test ("hello world") shows that PHP with
-LiteSpeed SAPI has 30% better performance over PHP with FastCGI SAPI,
-which is nearly twice the performance that Apache mod_php can deliver.
+A simple benchmark test ("hello world") shows that PHP with LiteSpeed SAPI has
+30% better performance over PHP with FastCGI SAPI, which is nearly twice the
+performance that Apache mod_php can deliver.
-A major drawback of FastCGI PHP comparing to Apache mod_php is lacking
-the flexibilities in PHP configurations. PHP configurations cannot be
-changed at runtime via configuration files like .htaccess files or web
-server's virtual host configuration. In shared hosting environment,
-each hosting account will has its own "open_basedir" overridden in
-server configuration to enhance server security when mod_php is used.
-usually, FastCGI PHP is not an option in shared hosting environment
-due to lacking of this flexibility. LiteSpeed SAPI is carefully designed
-to address this issue. PHP configurations can be modified the same way
-as that in mod_php with the same configuration directives.
+A major drawback of FastCGI PHP comparing to Apache mod_php is lacking the
+flexibilities in PHP configurations. PHP configurations cannot be changed at
+runtime via configuration files like `.htaccess` files or web server's virtual
+host configuration. In shared hosting environment, each hosting account will has
+its own `open_basedir` overridden in server configuration to enhance server
+security when mod_php is used. Usually, FastCGI PHP is not an option in shared
+hosting environment due to lacking of this flexibility. LiteSpeed SAPI is
+carefully designed to address this issue. PHP configurations can be modified the
+same way as that in mod_php with the same configuration directives.
-PHP with LiteSpeed SAPI is highly recommended over FastCGI PHP for
-PHP scripting with LiteSpeed web server.
+PHP with LiteSpeed SAPI is highly recommended over FastCGI PHP for PHP scripting
+with LiteSpeed web server.
+## Building PHP with LiteSpeed SAPI
-Building PHP with LiteSpeed SAPI
-================================
-
-You need to add "--with-litespeed" to the configure command to build
-PHP with LiteSpeed SAPI, all other SAPI related configure options
-should be removed.
+You need to add `--with-litespeed` to the configure command to build PHP with
+LiteSpeed SAPI, all other SAPI related configure options should be removed.
For example:
- ./configure --with-litespeed
- make
-You should find an executable called 'php' under sapi/litespeed/
-directory after the compilation succeeds. Copy it to
-'lsws/fcgi-bin/lsphp' or wherever you prefer, if LiteSpeed web server
-has been configured to run PHP with LiteSpeed SAPI already, you just
-need to overwrite the old executable with this one and you are all
-set.
+```bash
+./configure --with-litespeed
+make
+```
-Start PHP from command line
-===========================
+You should find an executable called `lsphp` under `sapi/litespeed/` directory
+after the compilation succeeds. Copy it to `lsws/fcgi-bin/lsphp` or wherever you
+prefer, if LiteSpeed web server has been configured to run PHP with LiteSpeed
+SAPI already, you just need to overwrite the old executable with this one and
+you are all set.
-Usually, lsphp is managed by LiteSpeed web server in a single server
-installation. lsphp can be used in clustered environment with one
-LiteSpeed web server at the front, load balancing lsphp processes
-running on multiple backend servers. In such environment, lsphp can be
-start manually from command with option "-b <socket_address>", socket
-address can be IPv4, IPv6 or Unix Domain Socket address.
-for example:
+## Start PHP from command line
- ./lsphp -b [::]:3000
+Usually, `lsphp` is managed by LiteSpeed web server in a single server
+installation. lsphp can be used in clustered environment with one LiteSpeed web
+server at the front, load balancing lsphp processes running on multiple backend
+servers. In such environment, lsphp can be start manually from command with
+option `-b <socket_address>`, socket address can be IPv4, IPv6 or Unix Domain
+Socket address.
-have lsphp bind to port 3000 on all IPv4 and IPv6 address,
+For example:
- ./lsphp -b *:3000
+```bash
+./lsphp -b [::]:3000
+```
-have lsphp bind to port 300 on all IPv4 address.
+have lsphp bind to port 3000 on all IPv4 and IPv6 address,
- ./lsphp -b 192.168.0.2:3000
+```bash
+./lsphp -b *:3000
+```
-have lsphp bind to address 192.168.0.2:3000.
+have lsphp bind to port 300 on all IPv4 address,
- ./lsphp -b /tmp/lsphp_manual.sock
+```bash
+./lsphp -b 192.168.0.2:3000
+```
-have lsphp accept request on Unix domain socket "/tmp/lsphp_manual.sock"
+have lsphp bind to address 192.168.0.2:3000,
+```bash
+./lsphp -b /tmp/lsphp_manual.sock
+```
-Using LiteSpeed PHP with LiteSpeed Web Server
-=============================================
+have lsphp accept request on Unix domain socket `/tmp/lsphp_manual.sock`.
-Detailed information about how to configure LiteSpeed web server with
-PHP support is available from our website, at:
+## Using LiteSpeed PHP with LiteSpeed Web Server
-https://www.litespeedtech.com/docs/webserver
+Detailed information about how to configure LiteSpeed web server with PHP
+support is available from
+[LiteSpeed website](https://www.litespeedtech.com/docs/webserver).
-Usually, PHP support has been configured out of box, you don't need to
-change it unless you want to change PHP interface from FastCGI to
-LiteSpeed SAPI or vice versa.
+Usually, PHP support has been configured out of box, you don't need to change it
+unless you want to change PHP interface from FastCGI to LiteSpeed SAPI or vice
+versa.
Brief instructions are as follow:
-1) Login to web administration interface, go to 'Server'->'Ext App' tab,
- add an external application of type "LSAPI app", "Command" should be
- set to a shell command that executes the PHP binary you just built.
- "Instances" should be set to "1". Add "LSAPI_CHILDREN" environment
- variable to match the value of "Max Connections". More tunable
- environment variable described below can be added.
+1. Login to web administration interface, go to 'Server'->'Ext App' tab, add an
+ external application of type "LSAPI app", "Command" should be set to a shell
+ command that executes the PHP binary you just built. "Instances" should be
+ set to "1". Add "LSAPI_CHILDREN" environment variable to match the value of
+ "Max Connections". More tunable environment variable described below can be
+ added.
-2) Go to 'Server'->'Script Handler' tab, add a script handler
- configuration: set 'suffix' to 'php', 'Handler Type' to 'LiteSpeed
- API', 'Handler Name' should be the name of external application
- just defined.
+2. Go to 'Server'->'Script Handler' tab, add a script handler configuration: set
+ 'suffix' to 'php', 'Handler Type' to 'LiteSpeed API', 'Handler Name' should
+ be the name of external application just defined.
-
-3) Click 'Apply Changes' link on the top left of the page, then click
+3. Click 'Apply Changes' link on the top left of the page, then click
'graceful restart'. Now PHP is running with LiteSpeed SAPI.
-Tunings
--------
+## Tunings
There are a few environment variables that can be tweaked to control the
behavior of LSAPI application.
-* LSAPI_CHILDREN or PHP_LSAPI_CHILDREN (default: 0)
-
-There are two ways to let PHP handle multiple requests concurrently,
-Server Managed Mode and Self Managed Mode. In Server Managed Mode,
-LiteSpeed web server dynamically spawn/stop PHP processes, in this mode
-"Instances" should match "Max Connections" configuration for PHP
-external application. To start PHP in Self Managed Mode, "Instances"
-should be set to "1", while "LSAPI_CHILDREN" environment variable should
-be set to match the value of "Max Connections" and >1. Web Server will
-start one PHP process, this process will start/stop children PHP processes
-dynamically based on on demand. If "LSAPI_CHILDREN" <=1, PHP will be
-started in server managed mode.
-
-Self Managed Mode is preferred because all PHP processes can share one
-shared memory block for the opcode cache.
-
-Usually, there is no need to set value of LSAPI_CHILDREN over 100 in
-most server environment.
+* `LSAPI_CHILDREN` or `PHP_LSAPI_CHILDREN` (default: 0)
+ There are two ways to let PHP handle multiple requests concurrently, Server
+ Managed Mode and Self Managed Mode. In Server Managed Mode, LiteSpeed web
+ server dynamically spawn/stop PHP processes, in this mode "Instances" should
+ match "Max Connections" configuration for PHP external application. To start
+ PHP in Self Managed Mode, "Instances" should be set to "1", while
+ `LSAPI_CHILDREN` environment variable should be set to match the value of "Max
+ Connections" and greater than 1. Web Server will start one PHP process, this
+ process will start/stop children PHP processes dynamically based on on demand.
+ If `LSAPI_CHILDREN` less or equal to 1, PHP will be started in server managed
+ mode.
-* LSAPI_AVOID_FORK (default: 0)
+ Self Managed Mode is preferred because all PHP processes can share one shared
+ memory block for the opcode cache.
-LSAPI_AVOID_FORK specifies the policy of the internal process manager in
-"Self Managed Mode". When set to 0, the internal process manager will stop
-and start children process on demand to save system resource. This is
-preferred in a shared hosting environment. When set to 1, the internal
-process manager will try to avoid freqently stopping and starting children
-process. This might be preferred in a dedicate hosting environment.
+ Usually, there is no need to set value of `LSAPI_CHILDREN` over 100 in most
+ server environments.
+* `LSAPI_AVOID_FORK` (default: 0)
-* LSAPI_EXTRA_CHILDREN (default: 1/3 of LSAPI_CHILDREN or 0)
+ `LSAPI_AVOID_FORK` specifies the policy of the internal process manager in
+ "Self Managed Mode". When set to 0, the internal process manager will stop and
+ start children process on demand to save system resource. This is preferred in
+ a shared hosting environment. When set to 1, the internal process manager will
+ try to avoid freqently stopping and starting children process. This might be
+ preferred in a dedicate hosting environment.
-LSAPI_EXTRA_CHILDREN controls the maximum number of extra children processes
-can be started when some or all existing children processes are in
-malfunctioning state. Total number of children processes will be reduced to
-LSAPI_CHILDREN level as soon as service is back to normal.
-When LSAPI_AVOID_FORK is set to 0, the default value is 1/3 of
-LSAPI_CHIDLREN, When LSAPI_AVOID_FORK is set to 1, the default value is 0.
+* `LSAPI_EXTRA_CHILDREN` (default: 1/3 of `LSAPI_CHILDREN` or 0)
+ `LSAPI_EXTRA_CHILDREN` controls the maximum number of extra children processes
+ can be started when some or all existing children processes are in
+ malfunctioning state. Total number of children processes will be reduced to
+ `LSAPI_CHILDREN` level as soon as service is back to normal. When
+ `LSAPI_AVOID_FORK` is set to 0, the default value is 1/3 of `LSAPI_CHILDREN`,
+ When `LSAPI_AVOID_FORK` is set to 1, the default value is 0.
-* LSAPI_MAX_REQS or PHP_LSAPI_MAX_REQUESTS (default value: 10000)
+* `LSAPI_MAX_REQS` or `PHP_LSAPI_MAX_REQUESTS` (default value: 10000)
-This controls how many requests each child process will handle before
-it exits automatically. Several PHP functions have been identified
-having memory leaks. This parameter can help reducing memory usage
-of leaky PHP functions.
+ This controls how many requests each child process will handle before it exits
+ automatically. Several PHP functions have been identified having memory leaks.
+ This parameter can help reducing memory usage of leaky PHP functions.
+* `LSAPI_MAX_IDLE` (default value: 300 seconds)
-* LSAPI_MAX_IDLE (default value: 300 seconds)
+ In Self Managed Mode, LSAPI_MAX_IDLE controls how long a idle child process
+ will wait for a new request before it exits. This option help releasing system
+ resources taken by idle processes.
-In Self Managed Mode, LSAPI_MAX_IDLE controls how long a idle child
-process will wait for a new request before it exits. This option help
-releasing system resources taken by idle processes.
+* `LSAPI_MAX_IDLE_CHILDREN` (default value: 1/3 of `LSAPI_CHILDREN` or
+ `LSAPI_CHILDREN`)
+ In Self Managed Mode, `LSAI_MAX_IDLE_CHILDREN` controls how many idle children
+ processes are allowed. Excessive idle children processes will be killed by the
+ parent process immediately. When `LSAPI_AVOID_FORK` is set to 0, the default
+ value is 1/3 of `LSAPI_CHIDLREN`, When `LSAPI_AVOID_FORK` is set to 1, the
+ default value is `LSAPI_CHILDREN`.
-* LSAPI_MAX_IDLE_CHILDREN
- (default value: 1/3 of LSAPI_CHILDREN or LSAPI_CHILDREN)
+* `LSAPI_MAX_PROCESS_TIME` (default value: 300 seconds)
-In Self Managed Mode, LSAI_MAX_IDLE_CHILDREN controls how many idle
-children processes are allowed. Excessive idle children processes
-will be killed by the parent process immediately.
-When LSAPI_AVOID_FORK is set to 0, the default value is 1/3 of
-LSAPI_CHIDLREN, When LSAPI_AVOID_FORK is set to 1, the default value
-is LSAPI_CHILDREN.
+ In Self Managed Mode, `LSAPI_MAX_PROCESS_TIME` controls the maximum processing
+ time allowed when processing a request. If a child process can not finish
+ processing of a request in the given time period, it will be killed by the
+ parent process. This option can help getting rid of dead or runaway child
+ process.
+* `LSAPI_PGRP_MAX_IDLE` (default value: FOREVER)
-* LSAPI_MAX_PROCESS_TIME (default value: 300 seconds)
+ In Self Managed Mode, `LSAPI_PGRP_MAX_IDLE` controls how long the parent
+ process will wait before exiting when there is no child process. This option
+ helps releasing system resources taken by an idle parent process.
-In Self Managed Mode, LSAPI_MAX_PROCESS_TIME controls the maximum
-processing time allowed when processing a request. If a child process
-can not finish processing of a request in the given time period, it
-will be killed by the parent process. This option can help getting rid
-of dead or runaway child process.
+* `LSAPI_PPID_NO_CHECK`
+ By default a LSAPI application check the existence of its parent process and
+ exits automatically if the parent process died. This is to reduce orphan
+ process when web server is restarted. However, it is desirable to disable this
+ feature, such as when a LSAPI process was started manually from command line.
+ `LSAPI_PPID_NO_CHECK` should be set when you want to disable the checking of
+ existence of parent process. When PHP is started by `-b` option, it is
+ disabled automatically.
-* LSAPI_PGRP_MAX_IDLE (default value: FOREVER )
-
-In Self Managed Mode, LSAPI_PGRP_MAX_IDLE controls how long the parent
-process will wait before exiting when there is no child process.
-This option help releasing system resources taken by an idle parent
-process.
-
-
-* LSAPI_PPID_NO_CHECK
-
-By default a LSAPI application check the existence of its parent process
-and exits automatically if the parent process died. This is to reduce
-orphan process when web server is restarted. However, it is desirable
-to disable this feature, such as when a LSAPI process was started
-manually from command line. LSAPI_PPID_NO_CHECK should be set when
-you want to disable the checking of existence of parent process.
-When PHP started by "-b" option, it is disabled automatically.
-
-
-Compatibility with Apache mod_php
-=================================
+## Compatibility with Apache mod_php
LSAPI PHP supports PHP configuration overridden via web server configuration
-as well as .htaccess.
-Since 4.0 release "apache_response_headers" function is supported.
-
-
+as well as `.htaccess`.
-Contact
-=======
+Since 4.0 release `apache_response_headers` function is supported.
-For support questions, please post to our free support forum, at:
+## Contact
-https://www.litespeedtech.com/support/forum/
+For support questions, please post to the free support
+[forum](https://www.litespeedtech.com/support/forum/):
For bug report, please send bug report to bug [at] litespeedtech.com.
diff --git a/sapi/litespeed/config.m4 b/sapi/litespeed/config.m4
index eba8642eb4..3e9175ae2d 100644
--- a/sapi/litespeed/config.m4
+++ b/sapi/litespeed/config.m4
@@ -2,8 +2,10 @@ dnl config.m4 for sapi litespeed
AC_MSG_CHECKING(for LiteSpeed support)
-PHP_ARG_WITH(litespeed,,
-[ --with-litespeed Build PHP as litespeed module], no)
+PHP_ARG_WITH([litespeed],,
+ [AS_HELP_STRING([--with-litespeed],
+ [Build PHP as litespeed module])],
+ [no])
if test "$PHP_LITESPEED" != "no"; then
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/litespeed/Makefile.frag,$abs_srcdir/sapi/litespeed,sapi/litespeed)
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index a2eb54ae95..e553ba1ed0 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -28,10 +28,7 @@
#include "lsapilib.h"
#include <stdio.h>
-
-#if HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#if HAVE_UNISTD_H
#include <unistd.h>
@@ -46,12 +43,7 @@
#endif
-#if HAVE_SIGNAL_H
-
#include <signal.h>
-
-#endif
-
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@@ -65,7 +57,7 @@
/* Key for each cache entry is dirname(PATH_TRANSLATED).
*
* NOTE: Each cache entry config_hash contains the combination from all user ini files found in
- * the path starting from doc_root throught to dirname(PATH_TRANSLATED). There is no point
+ * the path starting from doc_root through to dirname(PATH_TRANSLATED). There is no point
* storing per-file entries as it would not be possible to detect added / deleted entries
* between separate files.
*/
@@ -89,7 +81,6 @@ zend_compiler_globals *compiler_globals;
zend_executor_globals *executor_globals;
php_core_globals *core_globals;
sapi_globals_struct *sapi_globals;
-void ***tsrm_ls;
#endif
zend_module_entry litespeed_module_entry;
@@ -248,6 +239,7 @@ static void litespeed_php_import_environment_variables(zval *array_ptr)
return;
}
+ tsrm_env_lock();
for (env = environ; env != NULL && *env != NULL; env++) {
p = strchr(*env, '=');
if (!p) { /* malformed entry? */
@@ -262,6 +254,7 @@ static void litespeed_php_import_environment_variables(zval *array_ptr)
t[nlen] = '\0';
add_variable(t, nlen, p + 1, strlen( p + 1 ), array_ptr);
}
+ tsrm_env_unlock();
if (t != buf && t != NULL) {
efree(t);
}
@@ -1042,9 +1035,9 @@ static int cli_main( int argc, char * argv[] )
case 'v':
if (php_request_startup() != FAILURE) {
#if ZEND_DEBUG
- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
+ php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
#else
- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
+ php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
#endif
#ifdef PHP_OUTPUT_NEWAPI
php_output_end_all();
@@ -1230,14 +1223,12 @@ int main( int argc, char * argv[] )
int slow_script_msec = 0;
char time_buf[40];
-#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
signal(SIGPIPE, SIG_IGN);
#endif
-#endif
#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
+ php_tsrm_startup();
#endif
#if PHP_MAJOR_VERSION >= 7
@@ -1265,7 +1256,6 @@ int main( int argc, char * argv[] )
executor_globals = ts_resource(executor_globals_id);
core_globals = ts_resource(core_globals_id);
sapi_globals = ts_resource(sapi_globals_id);
- tsrm_ls = ts_resource(0);
SG(request_info).path_translated = NULL;
#endif
@@ -1535,12 +1525,3 @@ PHP_FUNCTION(litespeed_finish_request)
RETURN_FALSE;
}
/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h
index ee87a01053..c909b5f986 100644
--- a/sapi/litespeed/lsapidef.h
+++ b/sapi/litespeed/lsapidef.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index 926a832cea..c0c486cb15 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -93,6 +93,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define uint32 uint32_t
#endif
+#include <Zend/zend_portability.h>
+
struct lsapi_MD5Context {
uint32 buf[4];
uint32 bits[2];
@@ -779,7 +781,7 @@ static int (*fp_lve_leave)(struct liblve *, uint32_t *) = NULL;
static int (*fp_lve_jail)( struct passwd *, char *) = NULL;
static int lsapi_load_lve_lib(void)
{
- s_liblve = dlopen("liblve.so.0", RTLD_LAZY);
+ s_liblve = DL_LOAD("liblve.so.0");
if (s_liblve)
{
fp_lve_is_available = dlsym(s_liblve, "lve_is_available");
diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h
index f6e1f93067..07dbfb0ade 100644
--- a/sapi/litespeed/lsapilib.h
+++ b/sapi/litespeed/lsapilib.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/sapi/litespeed/lscriu.c b/sapi/litespeed/lscriu.c
index 1318214f58..9fa1de22c5 100644
--- a/sapi/litespeed/lscriu.c
+++ b/sapi/litespeed/lscriu.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -51,10 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "lsapilib.h"
#include <stdio.h>
-
-#if HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#if HAVE_UNISTD_H
#include <unistd.h>
@@ -91,6 +88,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <unistd.h>
#include "lscriu.h"
+#include <Zend/zend_portability.h>
+
#define LSCRIU_PATH 256
// Begin CRIU inclusion
@@ -265,8 +264,8 @@ static int LSCRIU_load_liblscapi(void)
int error = 1;
char *last;
- if (!(lib_handle = dlopen(last = "liblscapi.so", RTLD_LAZY)) /*||
- !(pthread_lib_handle = dlopen(last = "libpthread.so", RTLD_LAZY))*/)
+ if (!(lib_handle = DL_LOAD(last = "liblscapi.so")) /*||
+ !(pthread_lib_handle = DL_LOAD(last = "libpthread.so"))*/)
fprintf(stderr, "LSCRIU (%d): failed to dlopen %s: %s - ignore CRIU\n",
s_pid, last, dlerror());
else if (!(s_lscapi_dump_me = dlsym(lib_handle, last = "lscapi_dump_me")) ||
diff --git a/sapi/litespeed/lscriu.h b/sapi/litespeed/lscriu.h
index 02fc9b880a..e7618114cc 100644
--- a/sapi/litespeed/lscriu.h
+++ b/sapi/litespeed/lscriu.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |