Using PHP with Plesk and LiteSpeed Web Server

LiteSpeed Web Server v5.4 and later auto-detects and loads all available PHP versions. This means PHP should work with Plesk out-of-the-box after LSWS installation. There is no need to configure individual PHP external apps if you don't have any special requirements.

If you upgrade LSWS from an earlier version, there may be some existing internal apps and script handlers defined. There is no need to change any settings from LSWS Web Admin Console, as LSWS doesn't have its own native virtual hosts under Plesk. . If you need to change PHP versions or settings, you can simply do so through Plesk Admin (Domain > PHP Settings), the same way you would for Apache. LSWS reads Plesk Apache configuration files for virtual hosts and global settings.

Use this wiki as a means of understanding how LiteSpeed Web Server and Plesk work together in terms of PHP. You shouldn't need to take these steps during installation, because LSWS should just work with Plesk PHP right away.

CentOS/Ubuntu/Debian Users

LiteSpeed Web Server requires LSPHP, which Plesk has built into its multi-version PHP rpms for CentOS, Ubuntu, and Debian. LSPHP is automatically installed when you install any version of Plesk Multi-PHP.

Plesk versions older than 12.0 only support having a single version of PHP set up. Multi-PHP support started in Plesk 12.0. For CentOS/Ubuntu/Debian users, LSPHP will be installed through Plesk PHP CLI packages when you install any PHP version.

/opt/plesk/php/5.2/bin/lsphp
/opt/plesk/php/5.3/bin/lsphp
/opt/plesk/php/5.4/bin/lsphp
/opt/plesk/php/5.5/bin/lsphp
/opt/plesk/php/5.6/bin/lsphp
/opt/plesk/php/7.0/bin/lsphp
/opt/plesk/php/7.1/bin/lsphp
/opt/plesk/php/7.2/bin/lsphp
/opt/plesk/php/7.3/bin/lsphp
plesk-php52-cli
plesk-php53-cli
plesk-php54-cli
plesk-php55-cli
plesk-php56-cli
plesk-php70-cli
plesk-php71-cli
plesk-php72-cli
plesk-php73-cli
plesk-php55-cli
plesk-php56-cli
plesk-php70-cli

If any PHP versions are not installed, you can install them through the command line:

plesk sbin autoinstaller --select-product-id plesk --select-release-current  --install-component phpx.x

PHP packages from the Plesk team are available on:

Plesk 12: CentOS 6, CentOS 7, and Ubuntu 12
Plesk 12.5: Ubuntu 12/14, Debian 7/8 and CentOS/RHEL 6, 7 operating systems.

Verify Apache Ignore Modules

Check the LiteSpeed setting Apache Ignore Modules located in the LiteSpeed WebAdmin Console under Server > General > Using Apache Configuration File. Make sure the following modules are ignored: mod_php5,sapi_apache2,python,mod_php4,mod_php7, otherwise you may experience a “Forbidden: PHP engine is disabled.” error, which is possibly caused by a PHP admin setting within those modules.

NOTE: mod_fcgid should NOT be ignored.

Must use FastCGI Application, not php-fpm

In Plesk Admin, under Domains > example.com > PHP settings, when setting up PHP for a domain, PHP should be run as a FastCGI application instead of FPM application. Currently the LiteSpeed PHP selector doesn't work with FPM applications.

Verify your lsphp installations

Please refer to this Plesk documentation to ensure Plesk's multi-version PHPs have been installed. It can also be checked through the Plesk GUI under Add/Remove Components > Web hosting features > Different PHP interpreter versions. Install them if they are not yet installed.

The LSPHP binary is included in the Pleas PHPxx CLI package and the installation location should be:

find / | grep /bin/lsphp
/opt/plesk/php/5.5/bin/lsphp
/opt/plesk/php/5.2/bin/lsphp
/opt/plesk/php/5.3/bin/lsphp
/opt/plesk/php/5.6/bin/lsphp
/opt/plesk/php/5.4/bin/lsphp
/opt/plesk/php/7.0/bin/lsphp

For CentOS:

[root@plesk12-5 conf]# rpm -qa | grep cli | grep plesk-php
plesk-php70-cli-7.0.8-centos6.16063012.x86_64
plesk-php52-cli-5.2.17-centos6.15100614.x86_64
plesk-php53-cli-5.3.29-centos6.15102117.x86_64
plesk-php54-cli-5.4.45-centos6.16032517.x86_64
plesk-php56-cli-5.6.23-centos6.16063012.x86_64
plesk-php55-cli-5.5.37-centos6.16063013.x86_64

For Debian/Ubuntu:

root@plesk125debian7:~# dpkg -l | grep cli | grep plesk-php
ii  plesk-php52-cli                    5.2.17-debian7.0.15100614            amd64        Command-line interface for PHP
ii  plesk-php53-cli                    5.3.29-debian7.0.15102117            amd64        Command-line interface for PHP
ii  plesk-php54-cli                    5.4.45-debian7.0.16032517            amd64        Command-line interface for PHP
ii  plesk-php55-cli                    5.5.37-debian7.0.16063013            amd64        Command-line interface for PHP
ii  plesk-php56-cli                    5.6.23-debian7.0.16063012            amd64        Command-line interface for PHP
ii  plesk-php70-cli                    7.0.8-debian7.0.16063012             amd64        Command-line interface for PHP

If any plesk-php version is not installed, you can install it through the command line or Plesk GUI: Command line:

plesk sbin autoinstaller --select-product-id plesk --select-release-current  --install-component phpx.x
( x.x here can be 5.2, 5.3, 5.4, 5.5, 5.6, 7.0, any missing version). 

GUI: Navigate to the Plesk Installer interface and choose the PHP versions you need (Add/Remove Components > Web hosting features > Different PHP interpreter versions).

403 Forbidden error

If any suffixes are not properly setup, for example, php56 is not set to use the lsphp56 handler, then accounts using PHP 5.6 may still work from Apache, but LiteSpeed will return a 403 Forbidden error. This is because the related PHP handler has not yet been set for LiteSpeed Web Server.

For CloudLinux Users

On a CloudLinux system, you have a choice of using either Plesk Multi-PHP or CloudLinux PHP Selector. When installing LSWS, the installation script will automatically configure PHP to use Plesk Multi-PHP and to use PHP version 5.6 by default.

The following default external apps are added to LSWS during the installation: lsphp5x and lsphp7x are for Plesk Multi-PHP. lsphp_selector is for CloudLinux PHP Selector.

lsphp_selector is configured to use the command: /usr/local/bin/lsphp

By default, we configure Plesk Multi-PHP 56 as default handler out of the box.

If you want to set CloudLinux PHP Selector as the handler instead, you will need to change php and php5 handlers from lsphp56 to lsphp_selector as the following, assuming that you have installed CloudLinux CageFS, enabled CageFS for all users, and PHP-Selector and lvemanager have also been installed and configured correctly.

If you have not installed and configured CloudLinux PHP Selector yet, you can take a look the following steps before you configure on LSWS as above.

  • Admin
  • Last modified: 2019/09/19 19:31
  • by Lisa Clarke