A common error with Open Source Software like WordPress, Moodle, and 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 on the server. 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 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 Error"

The php memory resource can be increased in the php.ini located in the public_html. The following steps will explain how to set the php.ini to allow a larger amount of memory use.

  1. Login to your cPanel
  2. Go to the File Manager.

    Select the Web root (public_html/www) directory and click Go.

  3. Find the php.ini file in the public_html.

    Note! If you do not have a php.ini in your public_html files, you can have our tech support staff restore the php.ini to your public_html directory.

    Open the php.ini with the code editor.

  4. Find the following section in the php.ini file.

    max_execution_time = 30
    max_input_time = 60
    memory_limit = 128M

    Try increase the memory_limit value to 256M.

    If the php memory_limit is already at 256M, you can increase it to 512M.

    Save the changes.

  5. 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.

    Now visit the site. 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 in the public-html may be overriden by another setting elsewhere. If this is the case, you can contact our our tech support staff to have them look into the error further.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Like this Article?

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
2013-11-25 12:34 am
Hi. I have problem about memory limit. "Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 578 bytes) in /home/............... /admin/model/tool/export.php on line 352" appeared at my website when i import file import/export. I already changed memory_limit from 240M to 512M but still cannot add more option product.
Staff
8,172 Points
2013-11-25 9:46 am
As this is deep within your file structue, be sure that your php.ini is set to be recursive. You may see more information on this at the following:

Make the php.ini recursive in the .htaccess

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

2 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!