How to Increase the PHP Memory Limit on Shared Hosting

Raise your PHP memory limit in cPanel to fix out-of-memory errors when running plugins, imports, or heavy applications.

· Updated · 1,393 views

A "memory exhausted" or "allowed memory size" error means your application needs more PHP memory than is currently allocated. On shared hosting you can often raise this limit within your plan ceiling.

Method 1: Select PHP Version

  1. Log in to cPanel.
  2. Open Select PHP Version then go to the Options tab.
  3. Find memory_limit in the list.
  4. Select a higher value, such as 256M.
  5. Save the change and reload your site.

This is the cleanest method because it applies to your whole account.

Method 2: Edit php.ini or .user.ini

If you prefer a file-based approach, create or edit a .user.ini file in your site root:

memory_limit = 256M
max_execution_time = 120

Save the file, then wait a few minutes for the new value to take effect.

Method 3: wp-config.php for WordPress

For WordPress specifically, add this line above the "stop editing" comment in wp-config.php:

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

Limits on Shared Hosting

Shared plans cap how much memory a single account can use to keep the server fair for everyone. If your application still runs out of memory after raising the limit, the script may be inefficient, or you may need a larger plan. You can review options at my.nairohost.site or ask support on WhatsApp at +254 796 358081 to confirm your maximum allowed value.

Was this article helpful?

Your feedback helps us improve our documentation.

Still Need Help?

Our support team is available 24/7 to assist you.