Unlike Apache's mod_php, which embeds the PHP engine inside web server processes, LiteSpeed Web Server talks to standalone PHP engine processes via LSAPI interface. Unless you are using control panel PHP or CloudLinux PHP, You will need to

If you use any control panel such as cPanel, Plesk or DirectAdmin , you should refer to corresponding section for difference environment:cPanel PHP, Plesk PHP, DirectAdmin PHP. If you are using CloudLinux, PHP selector is recommended way to setup PHP.

PHP Installation

Configure PHP for LSWS OverviewLSPHP Setup Overview

Setup PHP when using Control Panels or Cloud Linux

Please refer to coresponding section of cPanel PHP setup, Plesk PHP setup, DirectDdmin PHP setup and CloudLinux PHP Selector.

Install PHP through LiteSpeed repositories

Installing LSPHP via RPMThe fastest way to get PHP for CentOS
Installing LSPHP via APTThe fastest way to get PHP for Debian/Ubuntu

PHP Mode

suEXEC or non-suEXECGuide to figure out which PHP setup you are using

Install PHP PECL Extensions

How to install pecl extention for LSPHPHow to check availability of lsphp pecl extention or build by yourself?

PHP Opcode Cache

Opcode Caching OverviewAn introduction to opcode caching, its limitations, and popular opcode caches
Enable opcode cacheHow to enable PHP opcode cache for litespeed?


PHP 7 InstallationHow to install PHP 7 on LSWS.

PHP Troubleshooting

PHP Execution ErrorsBasic steps to troubleshoot PHP-related issues in LSWS.
PHP 503 ErrorsBasic steps to troubleshoot PHP-503-related issues in LSWS.
How to enable php error log?Enable php error_log

Multiple-versions PHP Setup

Running multiple PHP versions in LiteSpeed + Control PanelHow to run multiple PHP versions in LiteSpeed with a control panel
Configuring cPanel + EasyApache 4 with LiteSpeedConfiguring LiteSpeed Web Server to work with cPanel + EasyApache 4

Performance tips

My site running slow, how to make it faster?How to improve my site performance?
My server load is high, how to resolve it?How to resolve my server load issue?
Controlling PHP ConcurrencyHow to control how many connections your PHP engine can serve at once
Understand LSWS "PHP suEXEC Max Conn" and Cloudlinux LVELSWS “PHP suEXEC Max Conn” should be always less than CL LVE EP
Log slow requests to error logIdentify scripts that are slowing down your server

Configuration Tips

LSPHP Command Line ModeGood for service scalability.
LSAPI Environment VariablesFurther configure LSAPI setups using directives and environment variables.
MySQL Persistent ConnectionsPerformance tip: avoid php/mysql persistent connections.
Disable PHP timeoutsMake LSWS compatible with long-running processes
Generate Source CodeUse LSAPI to generate source code for viewing with a browser
Environment Variables for PHP FCGI Applications?Supported environment variables for non-LSAPI applications
PHP Max Wait Queue LimitPreventing the PHP wait queue from getting too long
Disable 3rd party modules for specific accountsHow to disable a 3rd party module for a specific account
Control PHP max idle timeHow to control PHP max idle time
Increase PHP Memory LimitHow to increase PHP Memory Limit
How to use .user.ini with lsphp?Make .user.ini work with lsphp

Per User PHP.INI

Enabling Per-User php.ini FilesFour methods for enabling per-user php.ini

Per Directory PHP

Enabling Per Directory PHP in LSWS Native ModeEnabling Per Directory PHP in LSWS Native Mode


PHP + OracleHow to connect to Oracle with PHP + LSAPI
PHP5 + Suhosin Patch and Extension (FreeBSD 6.2)How to build a Litespeed PHP5 LSAPI With Suhosin Patch and Extension on FreeBSD 6.2
PHP Upload Progress BarHow to setup upload progress bar for PHP
New Relic Installation GuideHow to get New Relic to work with LSWS

Archive Only

Compile PHP for LSWS(Archive Only)Compiling PHP with LSAPI through the WebAdmin console
PHP Compilation Errors(Archive Only)A troubleshooting guide for compiling and installing a custom PHP with LSAPI
PHP LSAPI Ubuntu Package(Archive Only)How to create a .deb package with PHP + LSAPI for Ubuntu Dapper Drake and Edgy Eft
litespeed_wiki/php.txt · Last modified: 2018/07/06 13:01 by Jackson Zhang