Changing php.ini parameters on OpenLiteSpeed using Docker Compose with 5 steps.
In the previous article, AZDIGI showed you how to install WordPress with OpenLiteSpeed using Docker Compose on Ubuntu 22.04 and continuing in this article, AZDIGI will show you how to change php.ini parameters to increase performance more processing power for the server.
Step 1: Create an info file and check the configuration
- Create an info file to pre-check the configuration
In the previous article, AZDIGI showed you how to download the ols-docker-env package directly from litespeedtech; you download and configure it at which path, then you access the right path to create the info.php file.
By default, the path I configure will be at /home/ols-docker-env/sites/localhost/html/, so we will proceed to create the info.php file with the command:
Next, add the content below to the newly created file and save it.
<?php phpinfo(); ?>
Now open your browser and visit http://<IP-Addressem>/info.php to check the current PHP parameters.
The parameters I want to edit:
- max_execution_time: The default parameter is 30 (seconds), I will change it to 300 (seconds).
- memory_limit: The default parameter is 128M, I will change it to 512M
- upload_max_filesize: The default parameter is 2M, I will change it to 64M
- post_max_size: The default parameter is 8M, I will change it to 64M
Step 2: Locate php.ini and copy the file out
- Locate the php.ini file
To locate the php.ini file, you can quickly look through the info.php file in Step 1. At the check interface, you will see the Loaded Configuration File, section showing the path containing the php.ini file on openlitespeed container.
After determining the location of the php.ini file, we now need to copy the php.ini file from the Openlitespeed container to be able to edit it.
- Copy the php.ini file located in the openlitespeed container out for editing.
docker-compose exec litespeed su -c 'mv /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini /usr/local/lsws/conf'
Note: Replace lsphp74 and 7.4 with the PHP version you are using. For example, in PHP 8.0, you will enter lsphp80 and 8.0.
- Lệnh (1): Path to save the php.ini file on your server when edited.
- Lệnh (2): The path containing the php.ini file in the Openlitespeed container to return.
- Command (3): IMAGE_ID of the PHP service.
Step 3: Edit the php.ini file
Now you proceed to edit the php.ini file at your server by opening the php.ini file with the following command:
Next, you find the values you need to change and save them.
Step 4: Copy the file back to the Openlitespeed container
After editing the php.ini file, we will now move the edited file back to the Openlitespeed container. You do the following commands in turn:
- Copy the file back to the Openlitespeed container
docker-compose exec litespeed su -c 'mv /usr/local/lsws/conf/php.ini /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini'
- Restart PHP in the container
docker-compose exec litespeed su -c 'pkill lsphp'
Step 5: Recheck the parameters
After completing the above steps, open your browser and visithttp://<IP-Address>/info.php to check the parameters of PHP.
And below is my result, the parameters have been edited successfully.
So in this article, AZDIGI guide you to change php.ini parameters on OpenLiteSpeed using Docker Compose with a few speedy steps. Changing php.ini parameters will increase processing performance for your server, thereby helping the work become smooth and reach the highest efficiency. Wishing you success!
You can refer to other instructions at the link below:
If you need support, you can contact support in the ways below:
- Hotline 247: 028 730 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: firstname.lastname@example.org .