PHP
LiteSpeed will also attempt to automatically detect PHP handlers for popular control panel environments. As such you may not need to configure PHP handlers at all.
Table of Contents
Detached Mode | Default PHP Versions | Control Panel | CloudLinux Alt PHP | SuEXEC handlers
Max Connections | Environment | Initial Request Timeout (secs) | Retry Timeout (secs) | Connection Keepalive Timeout | Response Buffering | Back Log | Run On Start Up | Max Idle Time | Priority | Memory Soft Limit (bytes) | Memory Hard Limit (bytes) | Process Soft Limit | Process Hard Limit
Detached Mode⇑
Description
Run PHP handler processes detached from the main LiteSpeed worker process.
Syntax
Select from radio box
Tips
This has the advantage of allowing LiteSpeed to continue using detached PHP handler processes after restarting as opposed to having to start new PHP handler processes.
Default PHP Versions⇑
Description
A list of PHP versions to use as the default ".php" handler when a ".php" handler has not been explicitly set through a script handler or the "Handled suffixes" configuration.
The first available PHP handler, based on this list, will be used.
Syntax
Comma separated list of phpXX versions where XX is the combined major and minor PHP version number.
Example
Tips
All versions from php52 to php56 and php70 to php74 are available.
Control Panel⇑
Description
Auto detect PHP handlers based on the control panel used.
Default value is "auto detect".
Syntax
Select from drop down list
CloudLinux Alt PHP⇑
Description
Detect cloudlinux alt PHP handlers.
Default value is "Yes".
Syntax
Select from radio box
SuEXEC handlers⇑
Description
List of file suffixes associated with handlers in suEXEC mode. All automatically discovered PHP handlers are in suEXEC mode.
Syntax
Comma separated list of file suffixes
Example
Tips
This setting can be left as "Not Set" in most situations.
PHP Handler Definition⇑
Description
Add a custom PHP handler by only specifying "Handler ID", "Command", and optional "Handled Suffixes". This method will add an external application and associated script handler automatically.
External applications explicitly defined at the server level with the same "Handler ID" or "Command" will have a higher priority.
Tips
These settings may not be needed as automatically detected PHP handlers should work properly.
Handler ID⇑
Description
A unique ID used to associate this PHP handler's command to it's handled suffixes. The ID itself will also be treated as a handled suffix.
Well known IDs include "phpXX", "alt-phpXX", and "ea-phpXX".
Example
Tips
When adding a handler with ID "php72", files with suffix ".php72" as well as MIME type "application/x-httpd-php72" will be automatically handled by this handler.
Command⇑
Description
Command used to start the PHP handler.
Tips
This is usually the path to an "lsphp" binary.
Handled suffixes⇑
Description
Extra file "suffixes" to be handled by this handler.
Tips
If a script handler has been configured explicitly for a provided file suffix, this configuration will be ignored.
PHP Handler Defaults⇑
Description
Set the default configuration for handlers defined via PHP Handler Definition .
Max Connections⇑
Description
Specifies the maximum number of concurrent connections that can be established between the server and an external application. This setting controls how many requests can be processed concurrently by an external application, however, the real limit also depends on the external application itself. Setting this value higher will not help if the external application is not fast enough or cannot scale to a large number of concurrent requests.
Syntax
Integer number
Tips
Setting a high value does not directly translate to higher performance. Setting the limit to a value that will not overload the external application will provide the best performance/throughput.
Environment⇑
Description
Specifies extra environment variables for the external application.
Syntax
Key=value. Multiple variables can be separated by "ENTER"
Initial Request Timeout (secs)⇑
Description
Specifies the maximum time in seconds the server will wait for the external application to respond to the first request over a new established connection. If the server does not receive any data from the external application within this timeout limit, it will mark this connection as bad. This helps to identify communication problems with external applications as quickly as possible. If some requests take longer to process, increase this limit to avoid 503 error messages.
Syntax
Integer number
Retry Timeout (secs)⇑
Description
Specifies the period of time that the server waits before retrying an external application that had a prior communication problem.
Syntax
Integer number
Connection Keepalive Timeout⇑
Description
Specifies the maximum time in seconds to keep an idle persistent connection open.
When set to "-1", the connection will never timeout. When set to 0 or greater, the connection will be closed after this time in seconds has passed.
Syntax
int
Response Buffering⇑
Description
Specifies whether to buffer responses received from external applications. If a "nph-" (Non-Parsed-Header) script is detected, buffering is turned off for responses with full HTTP headers.
Syntax
Select from drop down list
Back Log⇑
Description
Specifies the backlog of the listening socket. Required if Start By Server is enabled.
Syntax
Integer number
Run On Start Up⇑
Description
Specifies whether to start the external application at server start up. Only applicable to external applications that can manage their own child processes and where Instances value is set to "1".
If enabled, external processes will be created at server startup instead of run-time.
When selecting "Yes (Detached mode)", all detached process can be restarted at the Server level or Virtual Host level by touching the '.lsphp_restart.txt' file under the $SERVER_ROOT/admin/tmp/ or $VH_ROOT/ directory respectively.
Default value: Yes (Detached mode)
Syntax
Select from radio box
Tips
If the configured external process has significant startup overhead, like a Rails app, then this option should be enabled to decrease first page response time.
Max Idle Time⇑
Description
Specifies the maximum idle time before an external application is stopped by the server, freeing idle resources. When set to "-1", the external application will not be stopped by the server unless running in ProcessGroup mode where idle external applications will be stopped after 30 seconds.
Default value: -1{/val}
Syntax
Integer number
Tips
This feature is especially useful in the mass hosting environment where, in order to prevent files owned by one virtual host from being accessed by the external application scripts of another virtual host, many different applications are run at the same time in SetUID mode. Set this value low to prevent these external applications from idling unnecessarily.
Priority⇑
Description
Specifies priority of the external application process. Value ranges from -20 to 20. A lower number means a higher priority. An external application process cannot have a higher priority than the web server. If this priority is set to a lower number than the server's, the server's priority will be used for this value.
Syntax
int
See Also
Server Priority
Memory Soft Limit (bytes)⇑
Description
Specifies the memory consumption limit in bytes for an external application process or an external application started by the server.
The main purpose of this limit is to prevent excessive memory usage because of software bugs or intentional attacks, not to impose a limit on normal usage. Make sure to leave enough head room, otherwise your application may fail and 503 error may be returned. It can be set at the server- level or at an individual external application level. The server-level limit will be used if it is not set at the individual application level.
The operating system's default setting will be used if the value is absent at both levels or set to 0.
Syntax
Integer number
Tips
Do not over adjust this limit. This may result in 503 errors if your application needs more memory.
Memory Hard Limit (bytes)⇑
Description
Much the same as Memory Soft Limit (bytes), except the soft limit can be raised up to the hard limit from within a user process. The hard limit can be set at server level or at an individual external application level. The server-level limit will be used if it is not set at an individual application level.
The operating system's default will be used if the value is absent at both levels or set to 0.
Syntax
Integer number
Tips
Do not over adjust this limit. This may result in 503 errors if your application need more memory.
Process Soft Limit⇑
Description
Limits the total number of processes that can be created on behalf of a user. All existing processes will be counted against this limit, not just new processes to be started.
The limit can be set at the server level or at an individual external application level. The server-level limit will be used if it is not set at an individual application level. The operating system's default setting will be used if this value is 0 or absent at both levels.
Syntax
Integer number
Tips
To control how many processes LSWS will make for users in mod_suEXEC mode, use the suEXEC Max Conn setting. PHP scripts can call for forking processes and the number of processes needed for normal functioning can be above the suEXEC Max Conn setting. The main purpose of this limit is as a last line of defense to prevent fork bombs and other attacks caused by PHP processes creating other processes.
Setting this setting too low can severely hurt functionality. The setting will thus be ignored below certain levels.
When Run On Start Up is set to "Yes (Daemon mode)", the actual process limit will be higher than this setting to make sure parent processes are not limited.
Process Hard Limit⇑
Description
Much the same as Process Soft Limit, except the soft limit can be raised up to the hard limit from within a user process. The hard limit can be set at the server level or at an individual external application level. The server-level limit will be used if it is not set at an individual application level. The operating system's default value will be used if the value is absent at both levels or set to 0.
Syntax
Integer number