PHP/MariaDB/MySQL

Increase PHP Memory

Updated November 2026 8,451 views 2 min read
PHP/MySQL | Updated November 2026

If your website shows a "Fatal error: Allowed memory size exhausted" message or a blank white page, your PHP scripts are exceeding the default memory limit. Here is how to increase it.

01. Via cPanel (Recommended)

  1. Log into cPanel > Software > MultiPHP INI Editor
  2. Select your domain from the dropdown
  3. Find memory_limit
  4. Change to 256M (or 512M for resource-heavy sites)
  5. Click Apply

02. Via .user.ini

Create or edit .user.ini in your public_html directory:

memory_limit = 256M

Changes take effect within 5 minutes.

03. WordPress: wp-config.php

WordPress has its own memory limit separate from PHP. Add this to wp-config.php before the "That's all, stop editing" line:

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

For the admin area, which often needs more memory for plugin operations:

define('WP_MAX_MEMORY_LIMIT', '512M');
Tip

If you need more than 512M regularly, the issue is likely an inefficient plugin or a code problem rather than a genuine memory need. Our free Pagemeter plugin ranks your plugins by how much PHP time each one spends building a page, which usually points straight at the memory culprit, and the Ultra Web Hosting Performance Toolkit trims per-request code and clears database bloat to lower the memory each page needs. See Optimize WordPress Performance.

For related settings like upload file size limits, see Changing Maximum Upload Size. For PHP version changes, see How to Change Your PHP Version.

Still Getting Memory Errors?

If increasing the limit does not help or errors keep coming back, open a ticket and we will check what is consuming memory on your account.

Open a Support Ticket

Frequently Asked Questions

How do I increase the PHP memory limit?

In cPanel go to Software, MultiPHP INI Editor, select your domain, set memory_limit to 256M (or 512M for heavy sites), and click Apply. The change takes effect immediately.

I raised the PHP memory but WordPress still runs out. Why?

WordPress enforces its own limit on top of PHP. Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php before the "stop editing" line, and WP_MAX_MEMORY_LIMIT set to 512M for the admin area.

How much memory should I actually set?

256M covers most sites and 512M covers resource-heavy ones. If you regularly need more than 512M, the cause is usually an inefficient plugin or a code problem rather than a genuine need, so investigate what is consuming the memory.

Do memory changes take effect right away?

Changes made in the cPanel MultiPHP INI Editor apply immediately. Changes made in a .user.ini file take effect within about 5 minutes.

Quick Recap

  1. cPanel MultiPHP INI Editor - Change memory_limit to 256M
  2. .user.ini - Alternative method, create in public_html
  3. WordPress: WP_MEMORY_LIMIT in wp-config.php
  4. More than 512M usually means a code problem - Investigate plugins
  5. Changes are immediate via cPanel, 5 minutes via .user.ini

PHP configuration · Last updated November 2026 · Browse all PHP/MySQL articles

Share: X in Reddit f Email
  • 136 Users Found This Useful

Was this answer helpful?

Related Articles

Changing Maximum Upload Size

PHP/MySQL | Updated November 2026 If you are getting errors like "The uploaded file exceeds...

Cannot Connect to MariaDB MySQL Database

PHP/MariaDB/MySQL | Updated November 2026 The "Could not connect to the database" error means...

InnoDB Error: Attempted to Open a Previously Opened Tablespace

Server Maintenance | Updated March 2026 The "Attempted to open a previously opened...

How to Add a User to a MariaDB/MySQL Database

PHP/MariaDB/MySQL | Updated November 2026 Every application that uses a database (WordPress,...

How to Manage Your Database with phpMyAdmin

PHP & MySQL | Updated July 2026 phpMyAdmin is the web tool every Ultra Web Hosting...



Save 30% on web hosting - Use coupon code Hosting30