Skip to content

Raising PHP upload_max_filesize on cPanel without breaking other accounts

How to bump upload_max_filesize, post_max_size, and max_input_time for one cPanel account so a customer can upload a 200 MB asset, without weakening the limits the rest of the server depends on.

A customer cannot upload a 180 MB video. They contact support, the default upload_max_filesize is 64M, and the temptation is to push it to 512M server-wide. The cost of that change is borne by every other tenant on the box: longer in-flight memory consumption per upload, larger temp files in /tmp, and a wider attack surface for resource-exhaustion abuse. The right answer is to raise the limit on the one account that needs it.

What’s happening

Three directives interact for uploads: upload_max_filesize, post_max_size, and memory_limit. PHP rejects any upload where Content-Length exceeds post_max_size, regardless of upload_max_filesize. post_max_size must be at least as large as the largest expected upload. memory_limit must be larger than post_max_size for the request to have headroom. Apache also has its own ceiling: LimitRequestBody, default 0 (unlimited) but sometimes set in security includes.

How to verify

For the account in question:

whmapi1 php_get_vhost_versions vhost=example.com
cat /var/cpanel/users/<user>/php.ini 2>/dev/null
grep -r "LimitRequestBody" /etc/apache2/
php --ini | head
apachectl -t -D DUMP_INCLUDES | grep -A2 example.com

The first command tells you which PHP version’s ini layer to edit. The grep ensures Apache’s LimitRequestBody is not the actual ceiling.

The fix

  1. WHM > MultiPHP INI Editor > Basic Mode > pick the user > set:
    • upload_max_filesize = 256M
    • post_max_size = 260M (a bit larger to allow form fields)
    • memory_limit = 512M
    • max_execution_time = 300
    • max_input_time = 300 Submit.
  2. Reload the FPM pool for the version: systemctl reload ea-php82-php-fpm.
  3. If Apache has LimitRequestBody set in a server include, edit it via WHM > Apache Configuration > Include Editor > Pre VirtualHost Include (or scope to the user’s vhost). The default of 0 means unlimited; only set a value here if you have a reason.
  4. Confirm /tmp has the space: df -h /tmp. PHP uploads larger than upload_tmp_dir’s available space fail with a confusing error. If /tmp is small (mounted tmpfs with 1G), point this account’s upload_tmp_dir at /home/<user>/tmp via the same INI editor.
  5. Test from the customer’s actual upload form. Watch the FPM log for the account: tail -f /opt/cpanel/ea-php82/root/usr/var/log/php-fpm.log. Watch error_log in the docroot too.
  6. After validation, write the override into your account-overrides notes. The next operator who sees upload_max_filesize = 256M should be able to look up why.

For environments where workload-specific PHP overrides are part of the customer profile, Stack Harbor tracks each override against its workload reason in environment management.