upload_max_filesize ?

#1
Hi, would it be possible someone could help me?

I've been using OpenLiteSpeed since around December and I'm very happy with it. Good job guys.
I'd like to move more WordPress sites to this, but I'm having trouble increasing the Maximum Upload File Size.

For the install method, I've followed the Docker install guides from https://docs.litespeedtech.com/cloud/docker/ & used the ./ scripts to get the domains, databases, and WordPress installed, everything is working fine.
I've had a good look on the internet/forums and haven't managed to get the Maximum Upload File Size to increase. So far I've tried editing the php.ini file located under the following path /ols-docker-env/lsws/admin-conf (docker install).

I have added a phpinfo.php file and the /phpinfo.php page is showing a mismatch from what I've set it to. I've tried using the "killall -9 lsphp" command and also fully rebooting the server. Yet it's still not changing.

Have I missed something? Kind of going round in circles trying to figure this out, thought its best to just ask for help. Please could someone show me how to increase the max file size on an OpenLiteSpeed Docker install?

The system is running PHP Version 7.4.13

Many thanks.
 

Cold-Egg

Administrator
#2
You might want to log into the litespeed container and edit the php.ini file here /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini. Increase both upload_max_filesize and post_max_size values.
Then rum the following command to restart PHP process from the host server.
Code:
docker-compose exec litespeed su -c 'pkill lsphp'
Let me know if it works to you.

And if you need to keep the value, please copy the php.ini to the host server and add a volume for it, then you only need to edit the file on host server in the future.
 
Last edited:
#3
Ahh, so it needs to be done from within the container. I was looking for a php.ini file in the install directory. (/ols-docker-env).

I did use the 'find -name php.ini' command and kind of found the file that way in the end (while I was waiting for this post to be approved). Once I edited the file the changes were visible on the phpinfo.php page so everything is working as expected.

I was trying to load in a website using the "All-in-One WP Migration" tool and it gets about 90sec in and then times out. I did change the following values:
post_max_size = 700M
upload_max_filesize = 600M
max_execution_time = 300
max_input_time = 300
memory_limit = 256

I also added the corresponding values to the .htaccess proceeded by 'php_value' and removed the = from the line.

I don't know if the time-out thing is just down to, maybe I've configured it wrong, maybe its the plugin playing up? I don't think its a LiteSpeed thing, its prob more my error than anything else.

Thanks for linking the correct command for restarting php & the hint of making a mapping for the php.ini, that's super useful.
 

Cold-Egg

Administrator
#4
You're welcome.

About time out issue, maybe you can try to insert the following line to the .htaccess file to avoid PHP abort, restart the webserver, then try it again.
Code:
RewriteRule .* - [E=noabort:1, E=noconntimeout:1]
 
#5
Hi @Cold-Egg , many thanks for all your help so far, it's greatly appreciated.

Unfortunately, I don't seem to be having much luck. The php.ini file stuff is sorted and the changes I've made are showing on the /phpinfo.php page. They persist across reboots.

But this time-out at about the 90s mark still persists. I found this (https://docs.litespeedtech.com/cp/cpanel/long-run-script/) while looking to check if id missed anything.
I've moved the rule to the top of the .htacess file, as it recommends, but it still times out at about 90s.

Is there anything else you can think to try?
Many thanks.
 

Cold-Egg

Administrator
#6
Oops, should be
Code:
RewriteRule .* - [E=noabort:1]
instead of
Code:
RewriteRule .* - [E=noabort:1, E=noconntimeout:1]
.
Default Connection Timeout (secs) is 300 under Web Admin>Server Configuration > Tuning, could you confirm it?
Do you know the size of the file that you want to upload? Maybe increasing memory_limit could help too.
Let us know if it makes any difference.
 
#7
Hi @Cold-Egg

I've adjusted the line in the .htaccess file, still no joy.
(had a look through the error logs after the process failed, and there are no entries in there to give any clues)

I can confirm the setting under Web Admin > Server Configuration > Tuning > Connection Timeout (secs) = 300.

The size of the file I'm trying to load in is 541MB. Seems to time-out about 90/100s into the process, at about 35%.

Many Thanks,
 

k0fein

New Member
#8
You might want to log into the litespeed container and edit the php.ini file here /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini. Increase both upload_max_filesize and post_max_size values.
Then rum the following command to restart PHP process from the host server.
Code:
docker-compose exec litespeed su -c 'pkill lsphp'
Let me know if it works to you.

And if you need to keep the value, please copy the php.ini to the host server and add a volume for it, then you only need to edit the file on host server in the future.

Could you write please, how to add a volume for php.ini for docker-compose file?
 

Cold-Egg

Administrator
#9
Hi, @k0fein

I will use lsphp80 as an example to set up a bind mount for php.ini.

1. Move/Copy the php.ini out of the litespeed folder, run the following commands from the host.

Code:
docker-compose exec litespeed su -c 'mv /usr/local/lsws/lsphp80/etc/php/8.0/litespeed/php.ini /usr/local/lsws/conf'
2. Add the php.ini bind mount in the docker-compose file

Edit docker-compose.yml file, and insert
Code:
- ./lsphp80:/usr/local/lsws/lsphp80/etc/php/8.0/litespeed
to litespeed > volumes. So it will looks like this

Code:
litespeed:
    image: litespeedtech/openlitespeed:${OLS_VERSION}-${PHP_VERSION}
    env_file:
      - .env
    volumes:
        - ./lsws/conf:/usr/local/lsws/conf
        - ./lsphp80:/usr/local/lsws/lsphp80/etc/php/8.0/litespeed
3. Move/Copy the php.ini back

Code:
docker-compose exec litespeed su -c 'mv /usr/local/lsws/conf/php.ini /usr/local/lsws/lsphp80/etc/php/8.0/litespeed/php.ini'
4. Change the permission to the host directory

Code:
sudo chown -R root:root lsphp80
Hope it helps, and I will put it on the doc soon.
 

k0fein

New Member
#10
Hi, @k0fein

I will use lsphp80 as an example to set up a bind mount for php.ini.

1. Move/Copy the php.ini out of the litespeed folder, run the following commands from the host.

Code:
docker-compose exec litespeed su -c 'mv /usr/local/lsws/lsphp80/etc/php/8.0/litespeed/php.ini /usr/local/lsws/conf'
2. Add the php.ini bind mount in the docker-compose file

Edit docker-compose.yml file, and insert
Code:
- ./lsphp80:/usr/local/lsws/lsphp80/etc/php/8.0/litespeed
to litespeed > volumes. So it will looks like this

Code:
litespeed:
    image: litespeedtech/openlitespeed:${OLS_VERSION}-${PHP_VERSION}
    env_file:
      - .env
    volumes:
        - ./lsws/conf:/usr/local/lsws/conf
        - ./lsphp80:/usr/local/lsws/lsphp80/etc/php/8.0/litespeed
3. Move/Copy the php.ini back

Code:
docker-compose exec litespeed su -c 'mv /usr/local/lsws/conf/php.ini /usr/local/lsws/lsphp80/etc/php/8.0/litespeed/php.ini'
4. Change the permission to the host directory

Code:
sudo chown -R root:root lsphp80
Hope it helps, and I will put it on the doc soon.
It works!:giggle: Thank you so much!
 
Top