cPanelOps · Hosting guides for site operators
cPanelOpsv2.2.0
Plain-English cPanel help from the team behind FirstResponderHost
26 guides live
CpanelOps / PageOps

Home › Guides

Troubleshooting

Raising PHP upload limits in cPanel, and when it will not help

Which four settings control upload size, where to change them, how to confirm the change took, and what else can block a large file.

"The uploaded file exceeds the upload_max_filesize directive." Anyone who has tried to upload a video, a large theme or a database export through a web form has met this message or a silent failure that means the same thing. The limit is a PHP setting, and on cPanel you can usually change it yourself.

The four settings involved

  • upload_max_filesize: the largest single file PHP will accept.
  • post_max_size: the largest whole form submission, files and fields together. It must be at least as big as upload_max_filesize, and a little bigger is sensible.
  • memory_limit: how much memory one request may use. It matters when the script processes the file after upload, for example resizing an image.
  • max_execution_time and max_input_time: how many seconds a request may run and how long PHP will spend receiving the data. Slow connections uploading big files run into these.

The trap is raising only the first one. If post_max_size is still smaller than the file, PHP discards the entire submission and the script sees an empty form, with no error message at all.

Where to change them

  1. In cPanel, open MultiPHP INI Editor.
  2. Choose the domain from the list.
  3. In Basic Mode, set the values, for example upload_max_filesize 64M and post_max_size 72M, and apply.

The editor writes the settings into a file in the site's folder, so they apply to that domain only. Settings are per domain and per folder; a subdomain with its own folder needs its own change.

Confirm the change took effect

Do not assume. In WordPress, Tools > Site Health > Info > Server lists the live values. Elsewhere, create a file containing <?php phpinfo();, open it in the browser, read the values, and then delete the file, because it shows details about the server that should not stay public.

If the old values still show, wait a few minutes; some servers re-read the settings on a timer. If they never change, the host has capped them for your plan and only the host can raise the cap.

When raising the PHP limits is not enough

Browsersends the fileProxy / CDNupload size capWeb serverbody limit, firewallPHPupload_max_filesizeYour appits own limitA large upload has to get past every box. Raising the PHP limit only moves one of them.
Every stage between the browser and your script can refuse a large file on its own.

PHP is only one of several things between the browser and the script, and each can refuse a large upload on its own:

  • The web server or its firewall. A request body limit in the server or in a ModSecurity rule produces a 413 or 403 error before PHP is even started. This is a setting for your host.
  • A proxy in front of the site. Services such as Cloudflare limit the size of a single upload on their lower plans, whatever your server allows.
  • The application. Many apps apply their own lower limit, set in their admin settings.
  • Disk quota. A full account fails uploads of any size. The usage figure is in cPanel's sidebar.

Better ways to move large files

Raising limits far enough for very large files makes every request on the site eligible to use that much time and memory, which is not a good trade on shared hosting. For big items there are better routes:

  • SFTP or File Manager for anything you are placing on the server yourself. Neither goes through PHP.
  • Chunked upload for files your visitors send. The browser splits the file into small pieces and sends them one at a time; the server joins them. Each request stays small, so none of the limits above is reached, and an interrupted upload can resume.
  • phpMyAdmin imports: compress the file to .sql.gz first, or import from the command line.

Common questions

What values are reasonable?

Set them for the largest file you genuinely expect through a web form, with some headroom, not for the largest file imaginable. For a site that takes photos and the occasional short video, upload_max_filesize of 64M with post_max_size a little above it is typical. A memory_limit of 256M covers most content systems.

I changed the settings and nothing happened.

Check that you edited the domain that actually serves the form, including the right subdomain. Then check the values with phpinfo(). If they are still old after ten minutes, the host has fixed them for your plan.

Why does the upload stop at exactly the same percentage every time?

A time limit, not a size limit. On a slow connection the upload takes longer than max_input_time or a proxy's timeout allows. Chunked upload is the lasting fix, because each piece finishes well inside any time limit.

Spotted a mistake, or a step that has changed?

cPanel's screens differ a little between versions and hosts. Tell us at info@firstresponderhost.com and we will correct the guide.

More guides