Symptoms
After applying a change in the cPanel MultiPHP INI Editor, the values aren't reflected on the websites when using LiteSpeed Web Server.
Description
LiteSpeed Web Server restricts users' ability to set PHP ini file values for some options that require PHP mode "PHP_INI_SYSTEM". So when applying changes in cPanel for PHP ini file settings, they won't be reflected.
LiteSpeed assumes control of the PHP handler when in use. This overall impacts the standard functionality of the cPanel software because a change is applied in the interface but not applied to the PHP settings of the accounts. The main reason why this occurs is that PHP has configuration modes. These configuration modes control where an option can be defined. You can find more details about PHP modes here:
Workaround
Note: These steps should be performed by a certified administrator to avoid conflicts or service failures. It is also important to take note of which PHP versions you want to customize as this is required throughout the process of adding or editing handlers in LiteSpeed. The steps can be repeated for each PHP version you want to automatically load php.ini
file values from public_html
.
In the LiteSpeed Web Server console, adjust the PHP configuration options:
- Log in to WHM.
- Navigate to LiteSpeed:
- Under Manage LiteSpeed Web Server, click LiteSpeed Configuration:
- Click WebAdmin Console:
- Log in with the LiteSpeed admin credentials.
- In the LiteSpeed WebAdmin console, click Configuration:
- Navigate to the External App tab:
- Click Add to the right of External Applications if the PHP version is not already listed. If the PHP version is listed, click Edit under Actions instead of Add:
- Clicking Add opens the interface to add custom PHP options for LiteSpeed. This LiteSpeed document contains additional details about how to configure this section:
LiteSpeed cPanel PHP overrideFor the purposes of demonstration, PHP 7.0 options have been filled in using this information:
Name: lsphp70
Address: uds://tmp/lshttpd/lsphp70.sock
Max Connections: 35
Environment:
PHP_LSPHP_CHILDREN=35
PHP_INI_SCAN_DIR=/opt/cpanel/ea-php70/root/etc/php.d:$VH_ROOT/public_html
Initial Request Timeout (secs): 60
Retry Timeout (secs): 0
Persistent Connection: Yes
Response Buffering: No
Start By Server: Yes (Through CGI Daemon Async)
Command: /opt/cpanel/ea-php70/root/usr/bin/lsphp
Back Log: 100
Instances: 1
Run On Startup: Yes (Detached)
Max Idle Time: 10
Memory Soft Limit (bytes): 2047
Memory Hard Limit (bytes): 2048
Process Soft Limit: 400
Process Hard Limit: 500Note: If the PHP versions are already defined in the External Apps list, you need to click Edit from this step and add this environment setting:
PHP_INI_SCAN_DIR=/opt/cpanel/ea-php70/root/etc/php.d:$VH_ROOT/public_html
As demonstrated in this screenshot:
- Click Save, then click the Script Handler tab:
- This tab opens up the options to either Add or Edit existing PHP handlers. Following the previous example to add PHP 7.0 in this section, we add the handler for PHP 7.0 and link it to the PHP options list. If the PHP versions are already defined in the list, there is no need to perform any changes. If PHP versions are not defined, you need to add one. For example, here are the options to set when adding the new handler for PHP 7.0:
Suffixes: php70
Handler Type: LiteSpeed
Handler Name: Select the dropdown option for "lsphp70"
(The dropdown will list PHP version created in step 7 and 8.) - Click Save.
- Perform a graceful restart of LiteSpeed. The confirmation of the configuration being modified also includes a graceful restart link:
- PHP ini file values defined in
public_html/php.ini
now load when making changes.
It is also possible to configure ini files on a domain or case-by-case basis. You can find more details in this LiteSpeed documentation page: