Increase Import/Upload limit for phpMyAdmin and File Manager in CWP
In this tutorial I’ll show you the configs in order to increase the upload memory limits under CWP control panel. By default upload limit is set to 64MB which is good for small databases and file import/upload through phpmyadmin and through file manager.
Below tutorial will guide you to increase upload limits quickly via command line, ensure you’ve root access and already logged into ssh terminal.
Lets get started :
I’ve created simple command which will increase upload limit automatically :
First backup existing CWP config file and php.ini by below command :
cp /usr/local/cwp/php71/php.ini /usr/local/cwp/php71/php.ini.bak cp /usr/local/cwpsrv/conf/cwpsrv.conf /usr/local/cwpsrv/conf/cwpsrv.conf.bak
Since update will revert back the config files and modifications in order to prevent I’ve created some simple one lined commands to modify it quickly :-
TO increase the upload limit to 512MB use the below commands one by one via terminal/ssh console:
sed -i 's,^post_max_size =.*$,post_max_size = 512M,' /usr/local/cwp/php71/php.ini && service cwpsrv-phpfpm restart sed -i 's,^upload_max_filesize =.*$,upload_max_filesize = 512M,' /usr/local/cwp/php71/php.ini && service cwpsrv-phpfpm restart sed -i 's,^max_input_time =.*$,max_input_time = 1800,' /usr/local/cwp/php71/php.ini && service cwpsrv-phpfpm restart sed -i 's,^max_execution_time =.*$,max_execution_time = 1800,' /usr/local/cwp/php71/php.ini && service cwpsrv-phpfpm restart sed -i 's,^memory_limit =.*$,memory_limit = 1024M,' /usr/local/cwp/php71/php.ini && service cwpsrv-phpfpm restart sed -i 's/client_max_body_size .*$/client_max_body_size 512M;/g' /usr/local/cwpsrv/conf/cwpsrv.conf && service cwpsrv restart
replace 512M to your desired value
You can always increase to higher upload limit for example for 5GB/5120M upload Limit use the below commands one by one via terminal/ssh console:
sed -i 's,^post_max_size =.*$,post_max_size = 5120M,' /usr/local/cwp/php71/php.ini && service cwp-phpfpm restart sed -i 's,^upload_max_filesize =.*$,upload_max_filesize = 5120M,' /usr/local/cwp/php71/php.ini && service cwp-phpfpm restart sed -i 's,^max_input_time =.*$,max_input_time = 3600,' /usr/local/cwp/php71/php.ini && service cwpsrv-phpfpm restart sed -i 's,^max_execution_time =.*$,max_execution_time = 3600,' /usr/local/cwp/php71/php.ini && service cwpsrv-phpfpm restart sed -i 's,^memory_limit =.*$,memory_limit = 1024M,' /usr/local/cwp/php71/php.ini && service cwp-phpfpm restart sed -i 's/client_max_body_size .*$/client_max_body_size 5120M;/g' /usr/local/cwpsrv/conf/cwpsrv.conf && service cwpsrv restart
replace 5120M to your desired value
Ensure you run this script for auto restart of cwp services :
sh /scripts/restart_cwpsrv
Now if you’re using cpanel.domain.tld then you need to increase a limit in Apache and nginx config :
For Apache edit this file :
nano /usr/local/apache/conf/httpd.conf
and add below config in first line **VALUE is in bytes :
for 512mb upload limit add it :
LimitRequestBody 536870912
For 5120mb upload limit add it :
LimitRequestBody 5368709120
then restart httpd service :
systemctl restart httpd
For nginx edit this file :
nano /etc/nginx/nginx.conf
Find client_max_body_size and replace its value to 512M or 5120M according what you’ve chosen the upload limit
eg. fro 512mb:
client_max_body_size 550M;
Then save it and restart nginx service :
systemctl restart nginx