Get started

How to increase the PHP upload limit and memory_limit in cPanel

Raise upload_max_filesize, post_max_size, memory_limit and max_execution_time in cPanel with MultiPHP INI Editor, or with Select PHP Version on CloudLinux servers, and check the change worked.

6 December 2026 · 6 min read

Sooner or later most sites hit a PHP limit. WordPress refuses a theme or a video with “The uploaded file exceeds the upload_max_filesize directive in php.ini”. An import plugin stops halfway. A page dies with “Allowed memory size of 134217728 bytes exhausted”. All three are PHP settings, and on cPanel hosting you can usually change them yourself in a couple of minutes.

This guide explains which settings matter, how they depend on each other, and how to change them in cPanel, including on CloudLinux servers where the right place to do it is a different screen.

The four settings that matter

SettingWhat it controlsPHP default
upload_max_filesizeThe largest single file that can be uploaded2M
post_max_sizeThe largest whole form submission, including every file in it8M
memory_limitThe most memory one PHP script may use128M
max_execution_timeHow many seconds a script may run30

Your host may already use different values from these PHP defaults; cPanel’s support documentation notes that cPanel sets the upload limit to 2MB by default.

The PHP manual sets out how the first three relate: post_max_size must be larger than upload_max_filesize, and, generally speaking, memory_limit should be larger than post_max_size. If a submission is bigger than post_max_size, PHP throws the data away and the script receives an empty form, which is why an over-size upload sometimes fails with no clear error at all.

A sensible set for uploading files of up to 64 MB would be:

upload_max_filesize = 64M
post_max_size = 72M
memory_limit = 256M
max_execution_time = 120

Only raise what you need. Generous limits on every site make it easier for one faulty script to use far more of the account than it should.

Check your current values first

In WordPress, go to Media » Add New Media File; the screen shows the maximum upload file size. Tools » Site Health » Info » Server lists the PHP memory limit, upload size, post size and time limit.

For any PHP site, create a file named info.php in the site’s folder containing:

<?php phpinfo();

Open it in your browser and search the page for the setting names. Delete the file as soon as you are done: it shows details about your server that should not be public.

Method 1: MultiPHP INI Editor

This is cPanel’s standard tool for PHP settings.

  1. In cPanel, open Software » MultiPHP INI Editor.
  2. On the Basic Mode tab, choose the domain you want to change, or Home Directory to apply the change to every site on the account.
  3. Change upload_max_filesize, post_max_size, memory_limit and, if needed, max_execution_time.
  4. Click Apply.

cPanel saves the values to the php.ini file, the .user.ini file and your .htaccess file, wherever each directive is supported. On servers that use the LSAPI handler, you will see a block like this appear in .htaccess:

<IfModule lsapi_module>
   php_value memory_limit 256M
   php_value upload_max_filesize 64M
</IfModule>

That is expected; leave it in place. cPanel’s support documentation puts the maximum for these upload variables at 2GB, and recommends FTP for anything larger. The Editor Mode tab lets you edit the file directly, but cPanel warns that mistakes there can stop your PHP scripts working, so Basic Mode is the safer choice.

Method 2: Select PHP Version on CloudLinux servers

Many hosts run CloudLinux, and then cPanel also has Software » Select PHP Version. If a version other than “native” is chosen there, the site runs CloudLinux’s own PHP builds, and that is where the settings are changed:

  1. Open Select PHP Version.
  2. Click Switch to PHP options.
  3. Change upload_max_filesize, post_max_size, memory_limit and max_execution_time. Changes are saved automatically.

If you changed a value in MultiPHP INI Editor and phpinfo still shows the old one, this is the most likely reason. The host decides which options appear here, so if one is missing, ask them.

Method 3: WordPress’s own memory limit

WordPress has a separate setting, WP_MEMORY_LIMIT. According to the WordPress documentation, WordPress tries to raise PHP’s memory to 40MB for a single site and 64MB for multisite, and only if PHP has less. If PHP already allows more, WordPress uses it. So if PHP is set to 256M, there is usually nothing to add. If you do need it, put this in wp-config.php above the line that says “That’s all, stop editing”:

define( 'WP_MEMORY_LIMIT', '256M' );

This cannot go higher than the PHP limit the host allows. The WordPress documentation also warns that raising the memory limit can hide the real problem, a plugin or theme using far too much memory, which then comes back as the site grows.

Still not working?

  • The change does not show in phpinfo. Check that you edited the right domain (or Home Directory), then check Select PHP Version as above. Then give it a few minutes: PHP re-reads .user.ini files only every 300 seconds by default (user_ini.cache_ttl).
  • The site shows a 500 error after the change. Check each value for typos (PHP’s shorthand is 64M, not 64MB), put back the old value if needed, and see our guide to fixing a 500 error.
  • Uploads still fail at a set size. Some limits sit outside PHP, such as a request size limit in the web server, a CDN or a security rule. Your host can check.
  • The memory error comes back at a higher number. Something is leaking memory. Deactivate plugins one at a time on a staging copy to find it.

As of PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, the PHP manual describes memory_limit as a soft limit: an allocation that crosses it is, in most cases, allowed to finish before the fatal error is raised, with a separate hard ceiling set by memory_hard_limit_percent. You do not need to change anything for this, but it explains why a process can briefly report using a little more than the limit.

Frequently asked questions

How do I increase upload_max_filesize in cPanel?

Open Software » MultiPHP INI Editor, choose the domain in Basic Mode, raise upload_max_filesize and post_max_size, and click Apply. On CloudLinux servers you may need Select PHP Version » Switch to PHP options instead.

What should post_max_size be?

Larger than upload_max_filesize, because it covers the whole submission, not just one file. memory_limit should generally be larger again.

Why does WordPress still show a 2 MB upload limit?

Either the change went to a different domain or to Home Directory while the site has its own php.ini, or the site uses a CloudLinux PHP version set in Select PHP Version. Check the values in phpinfo.

Is it safe to set memory_limit to -1?

No. -1 removes the limit completely, so one faulty script can use all the memory your account is allowed and take the site down.

What is the largest upload size I can set in cPanel?

cPanel’s documentation gives 2GB as the maximum for these variables, and suggests FTP for bigger files. Your host may set a lower ceiling.

Hosting where you control PHP

On our shared hosting and WordPress hosting PHP settings are managed from cPanel, per site. If you need a value you cannot set yourself, open a ticket and we will look at it with you. Need more than shared hosting allows, or settings at server level? Our VPS hosting gives you root access, and if you look after several servers, our script for updating PHP settings for every version saves doing it one by one.

Tags:

increase upload_max_filesize cPanel

increase memory_limit cPanel

MultiPHP INI Editor

post_max_size

WordPress upload limit

Technical Guide

How to update PHP settings for every PHP version in cPanel and CloudLinux

A Bash script that applies the same php.ini values to every installed PHP version, with a backup of each file it changes.

Read More →

WordPress Guide

PHP 8.2 support ends on 31 December 2026: how to move WordPress to PHP 8.4 or 8.5 in cPanel

Back up, test and switch WordPress to a supported PHP version in cPanel, with an instant way back.

Read More →