# 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.
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.
PHP with LiteSpeed SAPI is highly recommended over FastCGI PHP for PHP scripting
with LiteSpeed web server.
## Building PHP with LiteSpeed SAPI
You need to add `--enable-litespeed` to the configure command to build PHP with
LiteSpeed SAPI, all other SAPI related configure options should be removed.
For example:
```bash
./configure --enable-litespeed
make
```
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.
## Start PHP from command line
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:
```bash
./lsphp -b [::]:3000
```
have lsphp bind to port 3000 on all IPv4 and IPv6 address,
```bash
./lsphp -b *:3000
```
have lsphp bind to port 300 on all IPv4 address,
```bash
./lsphp -b 192.168.0.2:3000
```
have lsphp bind to address 192.168.0.2:3000,
```bash
./lsphp -b /tmp/lsphp_manual.sock
```
have lsphp accept request on Unix domain socket `/tmp/lsphp_manual.sock`.
## Using LiteSpeed PHP with LiteSpeed Web Server
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.
Brief instructions are as follow:
1. Log into 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.
3. Click 'Apply Changes' link on the top left of the page, then click
'graceful restart'. Now PHP is running with LiteSpeed SAPI.
## 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 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.
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 environments.
* `LSAPI_AVOID_FORK` (default: 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 frequently stopping and starting children process. This might be
preferred in a dedicate hosting environment.
* `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)
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)
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_CHILDREN`, When `LSAPI_AVOID_FORK` is set to 1, the
default value is `LSAPI_CHILDREN`.
* `LSAPI_MAX_PROCESS_TIME` (default value: 300 seconds)
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)
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.
* `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
没有合适的资源?快使用搜索试试~ 我知道了~
php-8.1.9.tar.gz 最新官网安装包
需积分: 5 3 下载量 2 浏览量
2022-08-12
00:45:58
上传
评论
收藏 18.8MB GZ 举报
温馨提示
共21151个文件
phpt:17212个
c:841个
h:827个
原地址 https://www.php.net/distributions/php-8.1.9.tar.gz 迅雷下不动,浏览器也慢得只有几十K下载速度。 PHP 8.1.9 最新稳定版 PHP 8.1.9 是 PHP 语言的一个主版本更新。 它包含了很多新功能与优化项, 包括 JIT、命名参数、联合类型、注解、构造器属性提升、match 表达式、nullsafe 运算符、,并改进了类型系统、错误处理、语法一致性。 即时编译 PHP 8 引入了两个即时编译引擎。 Tracing JIT 在两个中更有潜力,它在综合基准测试中显示了三倍的性能, 并在某些长时间运行的程序中显示了 1.5-2 倍的性能改进。
资源详情
资源评论
资源推荐
收起资源包目录
php-8.1.9.tar.gz 最新官网安装包 (21151个子文件)
__serialize_007 46B
configure.ac 47KB
jump_x86_64_ms_pe_masm.asm 10KB
make_x86_64_ms_pe_masm.asm 9KB
make_i386_ms_pe_masm.asm 5KB
jump_i386_ms_pe_masm.asm 4KB
imagecreatefromstring_compatible_brand.avif 9KB
imagecreatefromstring_major_brand.avif 7KB
test1pix.avif 1KB
girl.avif 1KB
order_by_dep.awk 2KB
mk_eaw_tbl.awk 1KB
print_include.awk 122B
test.awk 24B
test_task.bat 5KB
build_task.bat 2KB
build.bat 1KB
mod_files.bat 1KB
buildconf.bat 346B
phpize.bat 288B
test.bat 282B
configure.bat 53B
tiny.bat 9B
bigtest 141B
README.REDIST.BINS 28KB
opcache-2.blacklist 116B
opcache-1.blacklist 99B
200x100.bmp 59KB
imagecreatefrombmp_basic.bmp 17KB
imagecreatefromstring.bmp 374B
test1bpix.bmp 142B
bug77391.bmp 102B
test-1pix.bmp 58B
test1pix.bmp 58B
test.bmp 58B
blank_file.bmp 0B
bug7131 35B
bug71313 143B
bug73144_1 80B
bug73144_2 58B
bug73825 16B
bug74101 75B
bug74103 97B
bug74111 24B
bug74614 114B
bug75054 145B
resourcebundle.build 1KB
buildconf 4KB
72613.bz2 351B
003私はガラスを食べられます.txt.bz2 126B
003.txt.bz2 126B
004_1.txt.bz2 125B
004_2.txt.bz2 123B
data_file.c 40.56MB
parse_date.c 542KB
pcre2_jit_compile.c 429KB
zend_language_parser.c 358KB
pcre2_compile.c 342KB
zend_compile.c 311KB
itab.c 278KB
zend_jit_trace.c 271KB
pcre2_ucd.c 270KB
ffi.c 229KB
zend_language_scanner.c 218KB
pcre2_match.c 216KB
openssl.c 204KB
php_reflection.c 192KB
array.c 171KB
minilua.c 170KB
pgsql.c 161KB
zend_execute.c 158KB
exif.c 157KB
php_date.c 151KB
zend_jit.c 148KB
phar_object.c 147KB
zend_inference.c 147KB
string.c 143KB
zend_API.c 143KB
ZendAccelerator.c 142KB
soap.c 141KB
pcre2_dfa_match.c 136KB
php_imap.c 135KB
libsodium.c 127KB
mbstring.c 122KB
ldap.c 120KB
lsapilib.c 117KB
gdfontg.c 113KB
interface.c 110KB
php_encoding.c 109KB
gdfontl.c 108KB
php_sdl.c 107KB
gd.c 106KB
zend_inheritance.c 106KB
phar.c 104KB
ffi_parser.c 98KB
spl_iterators.c 97KB
php_odbc.c 94KB
zend_strtod.c 92KB
zend_alloc.c 92KB
session.c 90KB
共 21151 条
- 1
- 2
- 3
- 4
- 5
- 6
- 212
Rudon滨海渔村
- 粉丝: 7135
- 资源: 66
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0