Skip to content

Install PHP

OpenLiteSpeed uses lsphp (LiteSpeed PHP) as its default PHP processor. lsphp is a PHP build optimized for LiteSpeed’s native LSAPI protocol, delivering significantly better performance than PHP-FPM or standard FastCGI.

Terminal window
rpm -Uvh https://rpms.litespeedtech.com/centos/litespeed-repo-1.3-1.el9.noarch.rpm

For EL8 systems, replace el9 with el8.

Terminal window
wget -O - https://repo.litespeed.sh | sudo bash

The LiteSpeed repository provides the following PHP versions:

Package prefixPHP versionStatus
lsphp747.4.xSecurity fixes only
lsphp808.0.xEOL
lsphp818.1.xSecurity fixes only
lsphp828.2.xActive support
lsphp838.3.xActive support
lsphp848.4.xActive support (recommended)

RHEL / AlmaLinux / Rocky:

Terminal window
dnf install lsphp84 lsphp84-mysqlnd lsphp84-xml lsphp84-gd \
lsphp84-mbstring lsphp84-opcache lsphp84-curl lsphp84-json \
lsphp84-zip lsphp84-bcmath lsphp84-intl

Debian / Ubuntu:

Terminal window
apt install lsphp84 lsphp84-mysql lsphp84-xml lsphp84-gd \
lsphp84-mbstring lsphp84-opcache lsphp84-curl \
lsphp84-zip lsphp84-bcmath lsphp84-intl
Terminal window
# RHEL-based
dnf list lsphp84-*
# Debian-based
apt-cache search lsphp84

OLS looks for the PHP binary at /usr/local/lsws/fcgi-bin/lsphp. Create a symlink to the installed version:

Terminal window
ln -sf /usr/local/lsws/lsphp84/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp

To switch PHP versions later, update this symlink to point to a different lsphp binary (e.g., lsphp83).

Terminal window
/usr/local/lsws/lsphp84/bin/lsphp -v

Expected output:

PHP 8.4.x (litespeed) ...

Note the (litespeed) SAPI identifier — this confirms LSAPI support is compiled in.

You can install multiple lsphp versions simultaneously and assign them to different virtual hosts. Install each version:

Terminal window
dnf install lsphp83 lsphp84

Then configure separate external applications in httpd_config.conf for each version, pointing to the correct binary path:

extprocessor lsphp83 {
type lsapi
address uds://tmp/lshttpd/lsphp83.sock
maxConns 10
env PHP_LSAPI_CHILDREN=10
initTimeout 60
retryTimeout 0
respBuffer 0
autoStart 1
path /usr/local/lsws/lsphp83/bin/lsphp
backlog 100
instances 1
}

The php.ini for each lsphp version is located at:

/usr/local/lsws/lsphp84/etc/php/8.4/litespeed/php.ini

After modifying php.ini, restart OLS to apply changes:

Terminal window
systemctl restart lsws