PHP LiteSpeed Server API suEXEC Worker Mode https://download.litespeedtech.com/images/logos/litespeed/litespeed-logo.png 2024-01-24 18:37:52 suEXEC Worker is LiteSpeed's default suEXEC setup. suEXEC Worker spawns new processes whenever PHP is needed. It controls system resource usage by killing processes when they finish.

PHP LSAPI Worker Mode

PHP LSAPI's Worker mode, a customizable and resource efficient PHP process mode for shared hosting.

What is suEXEC?

suEXEC is an execution method that makes PHP more secure by running each PHP process as the owner of a particular account instead of the user running the web server. This means that even if one user on a server is compromised, PHP scripts run from their account will not have access to other users' files. suEXEC has long been a basic feature of shared hosting and is completely supported by all LiteSpeed PHP process modes.

What is Worker mode?

Worker Mode dynamically creates new PHP processes when needed. It controls system resource usage by killing processes when they finish.

Benefits

Efficient resource usage

Worker mode conserves resources by only starting new PHP processes when needed and killing any idle processes.

Allows custom php.ini files

Worker mode is compatible with custom php.ini files including CloudLinux’s CageFS php.ini files, allowing the use of CloudLinux's PHP Selector.


Comparison to other setups

  • Apache/nGinx (suPHP) vs. LSPHP

    suPHP is the standard suEXEC execution method for Apache.

    • All LiteSpeed process modes (Worker, Daemon, and ProcessGroup) are far faster than suPHP because suPHP uses CGI which is much, much slower than LiteSpeed's LSAPI.
  • Apache/nGinx Setups (PHP-FPM) vs. Worker mode

    PHP-FPM allows Apache and other servers to make use of FastCGI with PHP.

    • FastCGI is a speedier than CGI, but, our benchmarks show, LSAPI is still about 20% faster than FCGI.
    • To get security similar to suEXEC from PHP-FPM, you have to manually set up pools of processes for each user (though, once set up, PHP FPM does allow opcode caching).
    • Each of these pools always leave at least one process running, meaning wasted system resources even when a particular site is inactive. This is especially a problem for servers with many users and thus many pools.
    • Worker mode requires no additional configuration and spawns processes dynamically, only using resources when and where you need them.
  • Other LiteSpeed PHP Process Modes

    Consult our guide to different LiteSpeed PHP Process Modes

Limitations

Worker mode creates a new PHP process when needed, resulting in the process's opcode cache flushing when the processes exits. This makes Worker mode incompatible with opcode and APCu caching. For this reason, you should only use Worker mode if you need custom php.ini files and server resources are too limited for ProcessGroup mode.

Creating a new processes has more overhead than forking child processes. This may cause Worker mode to be slightly slower than Daemon or ProcessGroup modes. This overhead can be greatly reduced by running in Daemon mode.


Configuration

Learn more about configuring Worker mode in our wiki.