Edit php.ini settings for OpenLiteSpeed.
Modifying PHP settings is a common task when setting up a PHP-based website. Most of the settings in OpenLiteSpeed can be configured with the Web Admin Console, but unfortunately this does not apply to the PHP settings. Although it is possible to add this functionality to the Web Admin Console with individual settings per virtual host, in this tutorial we will show you how to perform this task using the command line.
As an example, we are going to modify the php.ini for a WordPress site with PHP version 7.4.
The default OpenLiteSpeed installation directory is “/usr/local/lsws” which is also where all the configuration files are located.
Depending on the installed PHP version (can be several), all files related to PHP are stored in lsphp72, lsphp73 or lsphp74 for PHP version 7.2, 7.3 or 7.4, respectively. Since we are using PHP version 7.4, the php.ini file can be found in the “lsphp74” directory and more specifically in “etc/php/7.4/litespeed/php.ini” within this directory.
To edit this file, use your favorite editor, in our case vim, to open it.
# vi /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini
We can now modify the php directives that are necessary for WordPress to function properly.
memory_limit = 256M post_max_size = 256M upload_max_filesize = 256M max_execution_time = 360
Finally, we need to restart the OLS php module by executing the following command :
# killall -9 lsphp