Configure CloudLinux PHP Selector native version for cPanel and LiteSpeed

When you install CloudLinux PHP Selector along with CloudLinux alternative-phpxx, there is a native option. Alternative PHP binaries are installed to /opt/alt/phpxx/usr/local/bin/php or /opt/alt/phpxx/usr/local/bin/lsphp, while native versions are installed to /usr/local/bin/php or /usr/local/bin/lsphp.

For cPanel with EasyApache 3, PHP binaries are normally built through EasyApache. LSPHP is normally built for the matching PHP build and copied over to /usr/local/bin/lsphp.

For cPanel with EasyApache 4, PHP binaries are normally copied over from cPanel ea-phpxx packages. For example, if the default PHP is 5.6, /usr/local/bin/php should be copied from /opt/cpanel/ea-php56/root/usr/bin/php and /usr/local/bin/lsphp should be copied from /opt/cpanel/ea-php56/root/usr/bin/lsphp.

To confirm that the native version works and determine which PHP modules are enabled, simply run:

/usr/local/bin/php -i | more
/usr/local/bin/lsphp -i | more

After this, you have to check if the native version has been enabled for use.

[~]#  selectorctl --summary --show-native-version
4.4 e -
5.1 e -
5.2 e -
5.3 e -
5.4 e -
5.5 e d
5.6 e -
7.0 e -
native(5.4) - -

There is no “e” after “native(5.4)” hence it is not enabled yet. To enable it run:

 #/usr/bin/cl-selector --interpreter=php --set-enabled=native

Verify again:

 selectorctl --summary --show-native-version
 4.4 e -
 5.1 e -
 5.2 e -
 5.3 e -
 5.4 e -
 5.5 e d
 5.6 e -
 7.0 e -
 native(5.4) e -

For example, a domain was set to use native but showed the following error:“Your PHP installation appears to be missing the MySQL extension which is required by WordPress.” It showed the same error for both Apache and LiteSpeed.

When checking your LiteSpeed settings based on this reference, they seem fine.

Check the native version:

 
/usr/local/bin/php -i | more
/usr/local/bin/lsphp -i | more

Both showed mysql module enabled.

However, the native version was disabled in CloudLinux PHP selector which caused the error. Enabling it will clear the error.

  • Admin
  • Last modified: 2018/09/17 17:27
  • by Michael Alegre