Command unknown: diff13798232

Compile PHP for LSWS (with LSAPI)

This guide will take you through the steps to compile PHP (with LSAPI) for LiteSpeed Web Server (LSWS) using LSWS's WebAdmin console. This guide is recommended for for all users except WHM and DirectAdmin users. Our WHM Plugin and DirectAdmin's CustomBuild integration offer more convenient methods for compiling PHP to match your Apache installation.

LiteSpeed Server API (LSAPI) is LiteSpeed's open-source API for communications between LSWS and external applications. LSWS can also use PHP with FastCGI (PHP-FPM), but LSAPI has repeatedly been shown to be faster and more efficient than FastCGI. PHP LSAPI also contains functionality, like suEXEC Daemon and ProcessGroup modes, that PHP-FPM does not offer.

Compiling PHP

Access the Compile PHP utility

PHP can be compiled from the WebAdmin console. Under the Actions menu, go to Compile PHP.

Select the version of PHP you would like to use. If you would like to use a version not listed, you will have to edit the WebAdmin console's source code located at /usr/local/lsws/admin/html/utility/build_php/

Choose your PHP options

On the next screen you will choose PHP's compile options. This can be a complicated task. If you have PHP installed already, you can view your current configurations from a phpinfo() page. If you have been using mod_php or PHP-FPM (FastCGI) you can simply copy these options into the Configure Parameters field. Remove parameters specific to other SAPIs, such as –with-axps(2) (mod_php) or –enable-fastcgi (PHP-FPM). The WebAdmin console will add the –with-litespeed parameter (for using LSAPI) automatically.

Build PHP

The next screen will download and prepare PHP and the latest version of LSAPI. When the process is done, you can proceed to building PHP by pressing the Next button.

You will now be asked to log into your server and run the stipulated command as root. This is required for security reasons.

When the build process has started, you will be able to see an overview of what is happening in the Main Status field. You can view a detailed log, just below that. (The detailed log is useful if you run into an error.)

If the build completes successfully, you will be asked to restart LSWS to apply the new PHP build.

This can be done under the Actions menu.

Checking Installation

There are a number of ways to check whether your PHP installation was successful. One of the simplest is to runn the following code:

cd /usr/local/lsws/fcgi-bin/
./lsphp5 -v

It should return the information on your new PHP build:

PHP 5.5.15 (litespeed) (built: Aug 20 2014 14:09:09)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

Notice the litespeed in parentheses. This means that the PHP binary has been built with LSAPI support.


Build errors

If you hit errors while building PHP, please refer to our troubleshooting guide. Many common errors, as well as sample PHP configurations, are covered there.

503 errors

If you run into 503 errors, this is often indicative of a problem with PHP. Please see our 503 troubleshooting guide for the steps to diagnosing and fixing these errors.

litespeed_wiki/php/lsapi.txt · Last modified: 2014/08/20 21:00 by Michael Armstrong