LiteSpeed Web Server/OpenLiteSpeed Web Server on Unix systems
LiteSpeed PHP is an optimized compilation of PHP built to work with LiteSpeed
products through the LiteSpeed SAPI. LSPHP runs as its own process and has
its own standalone binary, which can be used as a simple command line binary to execute
PHP scripts from the command line.
The LSAPI is a highly optimized API that allows communication between
LiteSpeed and third party web engines. Its protocol is similar to FCGI, but is
more efficient.
This documentation will cover installing and configuring PHP with LSAPI
for a LiteSpeed Web Server and OpenLiteSpeed Web Server.
This guide will assume that either LSWS or OLS is installed with their
default paths and flags. The default installation directory for both web
servers is /usr/local/lsws and both can be run from the bin subdirectory.
Please note that throughout this documentation, version numbers have been
replaced with an x
to ensure this documentation stays correct in the future,
please replace these, as necessary, with the corresponding version numbers.
-
To obtain and install either LiteSpeed Web Server or OpenLiteSpeed Web Server, visit the
LiteSpeed Web Server wiki
» install page
or OpenLiteSpeed wiki
» install page.
-
Obtain and unpack the php source:
-
Configure and build PHP. This is where PHP can be customized with various options,
such as which extensions will be enabled. Run ./configure --help for a list of available
options. In the example, we'll use the default recommended configuration options for
LiteSpeed Web Server:
-
Checking The LSPHP Installation
One of the simplest ways to check whether the installation of PHP was successful
is to run the following code:
This should return information about the new PHP build:
Notice the litespeed
in parenthesis. This means that the PHP binary has been
built with LSAPI support.
Following the steps above, LiteSpeed / OpenLiteSpeed Web Server should
now be running with support for PHP as an SAPI extension. There are many more
configuration options available for LSWS / OLS and PHP. For more information,
check out the LiteSpeed wiki about
» PHP.
Using LSPHP from the command line:
LSPHP(LSAPI + PHP) command line mode is used to process PHP scripts running
on a remote server that does not necessarily have a web server running. It is used
to process PHP scripts residing on a local web server (separate). This setup is
suitable for service scalability as PHP processing is offloaded to a remote server.
Start lsphp from the command line on a remote server:
LSPHP is an executable and can be started manually and bound to IPv4, IPv6, or
Unix domain socket addresses with the command line option -b socket_address
Examples:
Have LSPHP bind to port 3000 on all IPv4 and IPv6 addresses:
Have LSPHP bind to port 3000 on all IPv4 addresses:
Have LSPHP bind to address 192.168.0.2:3000:
Have LSPHP accept requests on Unix domain socket /tmp/lsphp_manual.sock
:
Environment variables can be added before the LSPHP executable:
Currently LiteSpeed PHP can be used with LiteSpeed Web Server,
OpenLiteSpeed Web Server, and Apache mod_lsapi. For steps on
server-side configuration, visit the wiki pages for
» LiteSpeed Web Server
and » OpenLiteSpeed.
LSPHP can be installed in several other ways as well.
CentOS:
On CentOS, LSPHP can be installed from the LiteSpeed Repository or the Remi
Repository using » RPM.
Debian:
On Debian, LSPHP can be installed from the LiteSpeed Repository using
» apt.
cPanel:
Visit the respective » wiki page
about how to install LSPHP with cPanel and LSWS/OLS using EasyApache 4.
Plesk:
Plesk can be used with LSPHP on CentOS, CloudLinux, Debian, and Ubuntu,
for more details on this, visit the respective » wiki page