Jump to content

Recommended Posts

In this tutorial I’ll show you the configs in order to increase the upload memory limits under CWP control panel. 

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 or mail.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


Link to comment
Share on other sites

  • 1 month later...

Hi Sandeep,

I've been having trouble trying to find the source of an upload limit setting of 12M on a CWP server:

  • Apache version: Apache/2.4.56
  • PHP version: 8.2.0 Forced PHP-FPM: 8.2
  • MySQL version: 10.4.30-MariaDB
  • FTP version: 1.0.49
  • SSH Port: ****
  • MySql Port: ****
  • Web Servers: nginx-varnish-apache

The local post_max_size finishes up being 12M and is limiting the size of files I can upload in a Drupal site.




I have followed and reviewed all of the .ini files that are reported parsed.  I followed your tutorial above, changing the values to 64M.  I also went down the directory chain to the public_html directory from which the phpinfo file is served looking for any .htaccess files that may have a setting there.  None of these attempts were successful.  

Do you have any suggestions for where I might find the source of that 12M setting?


Link to comment
Share on other sites

6 hours ago, Sandeep B. said:
sh /scripts/php_big_file_upload 128
sh /scripts/php_big_file_upload 64

No luck.  After running the scripts, restarting Apache, Varnish & NginX, running sh /scripts/restart_cwpsrv, the upload_max_filesize did change on master (phpinfo) from 55 to 64M, but local stayed at 12M.  Post_max_size also stayed at 12M on local (phpinfo).  I had already manually changed /opt/alt/php-fpm74/usr/php/php.ini, /opt/alt/php-fpm82/usr/php/php.ini, /usr/local/php/php.ini in any case.

There is something somewhere setting this 12M value, but I'll be darned if I can find it!

Thanks for the input.

Edited by SeaScoot
Link to comment
Share on other sites

Thanks for the offer to check the server.

I did find this on StackOverflow:




I lost quite a bit of time trying to figure this out as well. Turns out that this will happen if you are using php-fpm. The php.ini file will be read, phpinfo() will tell you that it's been read, but the max filesize value (as well as a few others) will be ignored.

I experienced this with a Centos8 install, and it took me far too long to notice that it was using php-fpm instead of mod_php, so all the arguments to mod_php were being ignored.

Your options are to either install mod_php or just configure php-fpm properly (better).


Do you think this could be the issue?  I'm not sure how to go about the "configure php-fpm properly (better)"

Link to comment
Share on other sites

Further googling led me to the culprit!

Something (probably Drupal) had added a .user.ini file into public_html with the following directives:

error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
;Determines if Zend OPCache in enabled

On changing the upload_max_filesize and post_max_size, it solved my issue.  Apparently fastCGI cannot read php settings from a .htaccess file, but will from a .user.ini file.

Hope this helps others with the same issue.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...