This is an old revision of the document!
Using PHP with Plesk and LSWS
LSWS 5.4.x and up should work with Plesk out of the box after the installation since LSWS 5.4.x will auto-detect to load all available PHP versions and there is no need to config individual PHP external app if no special requirement. If you upgrade LSWS from an earlier version, there might be some exiting internal apps and script handlers defined.
LSWS will read Plesk Apache configuration files for virtual hosts and global settings hence LSWS won't have its own native virtual host on Plesk.
The following wiki is not necessary steps you have to do during the installation since LSWS should just work with Plesk PHPs after installation automatically, but rather to explain how LSWS works with Plesk PHPs.
CentOS/Ubuntu/Debian Users
LiteSpeed Web Server requires LSPHP and Plesk has those binary packages built into their multi-version PHP rpms for CentOS, Ubuntu, and Debian and automatically installed when you installed any version of Plesk Mutli-phps.
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 LiteSpeed Web Admin Console → Server → General → Using Apache Configuration File → Ignore Apache Modules
. Make sure the following modules are ignored: mod_php5,sapi_apache2,python,mod_php4,mod_php7
,otherwise you may experience ““Forbidden: PHP engine is disable.” error, which is possibly caused by a php admin setting within those modules. However, mod_fcgid
should NOT be ignored.
Must use FastCGI Application, not php-fpm
Plesk Admin → 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 multi-version PHPs have been installed. It can also be checked through the Plesk GUI: Add/Remove Components → Web hosting features → Different PHP interpreters versions
. Install them if they are not yet installed.
The lsphp binary is included in the plesk-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 interpreters 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
How to configure LSWS to use the CloudLinix PHP selector on Plesk
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.