LiteSpeed

LiteSpeed LSAPI for PHP explained

How LiteSpeed's LSAPI PHP handler works, why it is faster than CGI and suPHP, how it relates to PHP-FPM and CloudLinux limits, and what to do about PHP errors.

AdvancedcPanel hosting with LiteSpeed3 min read

Every PHP page your site serves is passed from the web server to a PHP process. On MdmHost, LiteSpeed Web Server uses its own handler, LSAPI (LiteSpeed Server Application Programming Interface), to do that. Understanding it helps when you read error messages or tune performance.

Before you start

Nothing to install: LSAPI is the default PHP handler on MdmHost cPanel servers and works with the PHP version you choose in Select PHP Version.

How LSAPI works

  • LiteSpeed keeps a small pool of PHP processes running per account and reuses them, instead of starting PHP for every request as CGI does.
  • Processes run as your cPanel user, inside your CloudLinux LVE and CageFS, so they are isolated from other accounts.
  • Idle processes stop after a short time, so an inactive site uses almost no memory.
  • LSAPI talks to LiteSpeed over a lightweight protocol designed for it, with less overhead than FastCGI.

LSAPI compared with other handlers

HandlerSpeedNotes
CGI / suPHPSlowStarts PHP for each request; no opcode cache benefit.
PHP-FPMFastCommon with Nginx and Apache event (see PHP-FPM on cPanel).
LSAPIFastNative to LiteSpeed; supports OPcache, .htaccess php_value, per-user isolation.

OPcache

LSAPI keeps PHP processes alive, so OPcache (compiled PHP code stored in memory) works well. Make sure the opcache extension is ticked in Select PHP Version; it is on by default for most versions.

How limits apply

Each running LSAPI process counts toward your CloudLinux limits:

  • Entry processes: each request being processed by PHP.
  • Physical memory: the memory of all your PHP processes together.
  • NPROC: total processes, including PHP.

This is why caching matters: a page served from LSCache does not start a PHP process at all. More in reading Resource Usage.

PHP settings with LSAPI

  • Use the Options tab in Select PHP Version (see PHP options).
  • php_value lines in .htaccess also work with LSAPI, but avoid setting the same value in two places.
  • .user.ini files are read too, with a short cache delay.

Troubleshooting

503 Service Unavailable

PHP processes could not start, often because the account hit its memory or process limit, or a PHP fatal error at startup. Check Resource Usage and cPanel → Metrics → Errors.

"Premature end of script headers" or "lsapi: Child process died"

PHP crashed during the request. Common causes are a broken extension (disable recently added ones) or memory exhaustion. Switch PHP version briefly to test.

Changes to PHP options are slow to apply

Running processes keep the old settings until they are recycled, usually within a minute.

Tip: If a site is slow but Resource Usage is fine, the bottleneck is usually database queries or external API calls, not the PHP handler. Profile the application before changing PHP settings.

Frequently asked questions

Can I switch to PHP-FPM?

On LiteSpeed servers, LSAPI is the supported and fastest option, so there is no need. PHP-FPM settings in cPanel apply only to Apache-based setups.

Does LSAPI work with all PHP versions?

Yes. All versions in the CloudLinux PHP Selector run through LSAPI.

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.