How to Increase PHP Memory, Upload and Execution Limits — cPanel & Hosting How-Tos cPanel & Hosting How-Tos

How to Increase PHP Memory, Upload and Execution Limits

By Genhost Team 2 min read

A handful of PHP errors — “memory exhausted”, “file exceeds the maximum upload size”, a script that “timed out” — all come from PHP limits set too low for what you’re doing. You can raise them yourself in cPanel. Here’s which setting fixes which error.

The four limits that matter

Setting Controls Typical value
memory_limit How much memory a script can use 256M
upload_max_filesize The biggest single file you can upload 64M+
post_max_size The biggest form/upload POST a little above upload_max_filesize
max_execution_time How long a script may run (seconds) 120–300

How to change them in cPanel

  1. In cPanel, open Select PHP Version (or MultiPHP INI Editor).
  2. Switch to the Options (or Editor) tab.
  3. Find each setting and raise it.
  4. Save — changes apply right away.

If you use MultiPHP INI Editor, pick your domain first, then adjust the values there.

Which to change for each error

  • “Allowed memory size … exhausted” → raise memory_limit (try 256M).
  • “The uploaded file exceeds the maximum” / can’t upload a theme or plugin → raise upload_max_filesize and post_max_size.
  • Import, backup or update times out → raise max_execution_time (and often memory_limit).

WordPress note

WordPress also has its own memory setting. If raising memory_limit in cPanel isn’t enough, add this to wp-config.php above the “stop editing” line:

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

Don’t overdo it

Raise limits to what you actually need, not to extremes. Very high limits let a runaway script consume a lot of resources on a shared server. If you regularly need large limits — big imports, heavy plugins, lots of concurrent processing — that’s a sign your site has outgrown shared hosting.

When limits aren’t the real fix

If you keep hitting limits, the underlying issue may be resources. Our Web Hosting and WordPress Hosting plans give generous limits on fast NVMe storage, and for a demanding site a Managed VPS provides dedicated memory and CPU so heavy tasks run comfortably. To check what you’re using, see understand your resource usage in cPanel.

Frequently asked questions

Why do I get 'Allowed memory size exhausted'?

Your script needs more memory than the current PHP memory_limit allows. Raise memory_limit in cPanel's PHP settings - 256M is a comfortable value for most WordPress sites - and the error usually clears.

Why can't I upload a large file or theme?

Two PHP limits cap uploads: upload_max_filesize and post_max_size. Raise both (post_max_size should be a little higher than upload_max_filesize) and the upload will go through.

My import or backup times out. What do I change?

Increase max_execution_time so long-running scripts have more time to finish. For very large jobs, also raise memory_limit. If it still times out, run the job in smaller batches or ask support.