Custom php.ini on LiteSpeed with cPanel

Custom php.ini set up in Cpanel

PHP configuration directives are specified in the php.ini file. We can make immediate changes in the functionality of php through php.ini file. Making changes to the default PHP configuration will effect all the users. So we can create Custom php.ini files for individual users.

To enable custom php.ini in litespeed webserver in cPanel, we need to make changes in the litespeed configuration from WHM

Litespeed server from WHM -> Litespeed configuration -> Admin Console ->configuration -> server -> External App ->lsphp5

Click on edit and make changes to the following sections.

Environment: Adding “PHPRC=$VH_ROOT” in environment section

suEXEC user: In this section add the username of account for that php.ini is enabled and add the group name of account for suEXEC group

Main -> Litespeed web server –> quick configuration of PHP suEXEC settings

Enable PHP suEXEC should be “Yes

Finally we need to restart litespeed webserver from backend(SSH).

# /etc/init.d/lsws restart

Now we can edit the PHP setting for specific user by creating a custom php.ini file on their home directory.

Check it and verify the user using custom php configuration

Test it by putting a info.php file

#vi /home/admin/public_html/info.php
<?

phpinfo();

?>
#chown user:user /home/admin/public_html/info.php

Go to the URL like http://your-domain.com/info.php

Check whether the new path is updated in ‘Loaded configuration file’ shown in info.php page (like below image)

pp

Facebook Comments