PHP LSAPI suEXEC Worker Mode

PHP LSAPI's default suEXEC setup, allowing for customizable, resource efficient shared hosting PHP.

What is suEXEC?

suEXEC makes PHP more secure by running each PHP process as the owner of a particular account and not as the web server user. 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.

What is suEXEC Worker mode?

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.

Benefits


Efficient resource usage

Because Worker mode only starts new processes when PHP is needed and kills processes when they finish, it leaves fewer idle processes.

Allows custom php.ini files

PHP suEXEC Worker is compatible with custom php.ini files, including CloudLinux’s CageFS php.ini files, and thus allows the use of CloudLinux's PHP Selector.

Comparison to other setups


Apache/nginx setups

vs. suPHP

suPHP is the standard suEXEC setup for Apache.

  • All LiteSpeed suEXEC modes (Worker, Daemon, and WorkerGroup) are far faster than suPHP because suPHP uses CGI. CGI is much, much slower than LiteSpeed's LSAPI.
vs. PHP-FPM Pools

PHP-FPM was created for 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).
  • These pools always leave at least one process in each pool running, meaning wasted system resources even when a particular site is not being used. This is especially a problem for servers with many users and thus many pools.
  • suEXEC Worker is set up by default and spawns processes dynamically, using resources when and where you need them.

Other LiteSpeed setups

Consult our guide to different LiteSpeed suEXEC setups

Limitations


Because each process in suEXEC Worker is created as a new process, opcode cache is flushed each time one of these processes exits. Thus suEXEC Worker is incompatible with opcode caching. For this reason, we recommend suEXEC Worker only for hosts who need custom php.ini files and whose resources are too limited for suEXEC ProcessGroup.

Creating brand new processes has more overhead than forking child processes. This may cause suEXEC Worker to be slightly slower than sueEXEC Daemon or WorkerGroup modes. Setting PHP processes to be started by the CGI Daemon (WebAdmin console > Configuration > External App > your external application > Auto Start) greatly reduces this overhead, though.

Configuration


suEXEC Worker is enabled by default when PHP suEXEC is configured in your Apache configs.

STAY CONNECTED