Table of Contents

PHP Process Modes

LiteSpeed Web Server offers a number of different PHP process modes to meet the various needs and goals of shared hosting providers: ProcessGroup mode, Daemon mode, and Worker mode. These process modes take effect regardless of PHP mode (standard vs detached) or execution method used (suEXEC vs non-suEXEC).

ProcessGroup Mode

Introduced in PHP LSAPI v6.4, ProcessGroup mode is the default process mode used for Apache Virtual Host PHP handlers. ProcessGroup mode provisions a parent process for each process group user. When running PHP using a suEXEC execution method, this parent process runs as the owner of the user's document root and spawns new child processes when that user needs a PHP process. This allows ProcessGroup mode to spawn processes quickly while allowing for extremely effective per-user opcode caches.

Benefits

Limitations

Setup

To use ProcessGroup mode, Start By Server must be set to Yes, Yes (Through CGI Daemon), or Yes (Through CGI Daemon Async) under WebAdmin Console > Configuration > External App > your_external_application.

In a LiteSpeed Web Server (native) environment, you can enable ProcessGroup mode by setting Instances to 1 and LSAPI_CHILDREN to a number greater than 1.

In a control panel environment, you can enable ProcessGroup mode by placing the LSPHP_ProcessGroup on directive in an httpd.conf file. If done in a Server level conf file, all Virtual Hosts will use ProcessGroup mode. If done in a Virtual Host level conf file, only that Virtual Host will use ProcessGroup mode.

Example configuration for control panel environment:

<IfModule LiteSpeed>
LSPHP_ProcessGroup on
LSPHP_Workers 15
</IfModule>

Note the two LiteSpeed-specific directives LSPHP_ProcessGroup and LSPHP_Workers. Apache will not understand these directives and may crash if it encounters them outside of by an <IfModule LiteSpeed> block.

Configuration tips

Additional configurations

Special notes for use with cPanel

Daemon Mode

Introduced in PHP LSAPI v6.0, Daemon mode forks all process from a single constantly running daemon process. This mode makes great use of opcode caching and dynamically spawning processes to reduce resource usage.

Benefits

Limitations

Setup

To set up Daemon mode, set Start By Server to Yes and Run On Start Up to Yes (Daemon mode) under WebAdmin console > Configuration > External App > your_external_application.

Worker Mode

Standard PHP with LSAPI. Worker Mode dynamically creates new PHP processes when needed.

Benefits

Limitations

Setup

LiteSpeed Web Server will use Worker mode when none of the setting requirements for ProcessGroup mode (default) or Daemon mode have been met. LiteSpeed Web Server may also automatically switch to Worker mode at the Server level if it detects a custom php.ini file while running in Daemon mode.

Mode Comparison

ProcessGroup Daemon Worker
Forks processes instead of spawning new processes Yes Yes No
Number of parent processes One for each process group
(each user)
1 0
Customize number of processes per account? Yes Yes Yes
Can enable only for certain virtual hosts? Yes No No
Custom php.ini supported? (Including CageFS custom php.ini) Yes No Yes
Opcode caching Dedicated per user Shared throughout server No