---
title: "How to Fix the Allowed Memory Size Exhausted Error"
description: "A common error with Open Source software like WordPress, Drupal, Moodle, and Joomla is the PHP \"Allowed memory size error\". Increasing the memory limit is an easy solution. This memory_limit can be..."
url: https://www.inmotionhosting.com/support/website/error-numbers/allowed-memory-size-exhausted/
date: 2012-12-26
modified: 2025-02-22
author: "Carrie Smaha"
categories: ["Website Error Numbers"]
type: post
lang: en
---

# How to Fix the Allowed Memory Size Exhausted Error

A common error with Open Source software like [WordPress](/support/edu/wordpress/), [Drupal](https://www.inmotionhosting.com/support/edu/drupal/), [Moodle](/support/edu/moodle/), and [Joomla](/support/edu/joomla/) is the PHP **“Allowed memory size error”**. Increasing the memory limit is an easy solution. This *memory_limit* can be changed in the *php.ini* in the *public_html* folder in your hosting account. This error can creep up in your website during the normal development process. The following is an example of the error:

`Fatal error: Allowed memory size of 268435465 bytes exhausted
(tried to allocate 280559520) in Unknown on line 0`

This is due to PHP variable data being stored in the memory that is not cleared while the PHP scripts for your CMS or web application are running.

**For those who code their own sites:** Coders use the **unset()** function to clear variable data that is no longer needed; however, with open source software, you will not want to alter any code.

## How to Fix the “Allowed Memory Size Exhausted” Error

The PHP memory resource can be increased in the **php.ini** file located in the **public_html** directory on your server. The following steps will explain how to set the php.ini to allow a larger amount of memory use.

1. **[Login to cPanel](/support/edu/cpanel/how-to-log-into-cpanel/)**.
2. **[Go to the File Manager](/support/edu/cpanel/using-file-manager-in-cpanel/)**, or FTP/SSH into your server.
3. Select the **Web root (public_html/www)** directory and **click Go**.
4. Find the **php.ini file** in the **public_html** directory.**Note!** If you do not have a *php.ini* in your *public_html* files, you can [have our tech support staff restore](/support/amp/how-to-get-great-technical-support/) the *php.ini* to your *public_html* directory.**Open the php.ini file** with a code editor.
5. Find the following section in the php.ini file.`max_execution_time = 30max_input_time = 60memory_limit = 128M`**Increase the `memory_limit` value to 256M**. If the PHP `memory_limit` is already at 256M, you can increase it to 512M.**Important:** The PHP `max_execution_time` is capped at **90 seconds** on [Shared Hosting Plans](https://www.inmotionhosting.com/shared-hosting) to prevent extremely long processes from impacting other users sharing the server resources. If you need a longer `max_execution_time`, consider one of our [VPS Hosting Plans](https://www.inmotionhosting.com/vps-hosting).
6. **Save** the changes.
7. In order for your memory limit to take effect you will need to **make the php.ini recursive**. **Important!** Making the php.ini recursive is an important step. If you do not know how to do this, please see our article on [Make the php.ini recursive in the .htaccess](/support/website/recursive-php-ini/).

Now visit the website these changes were applied to. You should not see the “Allowed memory size” error anymore. If the error still shows on your website, there may be a setting within the software itself that is overriding the change or the **php.ini** file in the **public_html** directory may be overwritten by another setting elsewhere. If this is the case, you can contact our [our tech support staff](/support/amp/how-to-get-great-technical-support/) to have them look into the error further.
