InMotion Hosting Support Center

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

Support Center Login

Social Media Login

   
Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
Our site is down
OUT OF MEMORY WHILE REGENERATING IMAGES IN PRESTASHOP
Wordpress Multisite Goes White Blank on Login
Fatal error: Allowed memory size of 67108864 in Open Cart
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
11,186 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
n/a Points
2014-11-12 1:53 am

Thanks for your description of the solution to this problem. I've read a lot of explanations of how to fix this and this was the best and it worked, in part because of your admonition to make the php.ini recursive. As it happens this also solved the "white screen of death" WP editing screen problem I was having. It turns out that was, at least for me, a memory problem, contrary to what a lot of people were saying elsewhere. So a big thank you!

n/a Points
2014-12-22 12:53 pm

I agree, very helpful article, thanks so much for sharing

n/a Points
2015-06-05 2:04 am

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 877375 bytes) in /www/htdocs/w0132262/wp-content/themes/thesis/lib/core/api/colors.php on line 206

Staff
40,817 Points
2015-06-05 9:55 am
Hello Vimal,

Did you follow the instructions above for how to fix the error? If so, what did you set the memory to? Have you tried increasing it to a higher limit?

Kindest Regards,
Scott M
n/a Points
2015-09-19 11:51 am

Scott,

 

Yes i did increase the memory, it is still giving me the same error.

n/a Points
2015-08-11 11:33 pm

Hi,In the file wamp\alias\phpmyadmin.conf just before </Directory> insert four lines below to obtain:

  php_admin_value upload_max_filesize 512M
  php_admin_value post_max_size 512M
  php_admin_value max_execution_time 720
  php_admin_value max_input_time 720
</Directory>

With this, I managed to import large SQL files. The largest file I actually imported was 278 MB

Staff
35,822 Points
2015-08-12 9:28 am
Hello Imran,

If you're running WAMP, then it's not running on our servers. We can try to give you some information, but you will need to look into memory consumption, current load on your server, etc in order to determine what's causing the program to fail due to memory exhaustion. You may require more memory on the computer that you're using a server.

I know you said that the largest file you imported was 278 MB, but the problem is the amount of memory your server is using at the time that you get the memory exhaustion error. You may need to also increase the MEMORY_LIMIT value which you don't show in your comment above.

I hope this helps to answer your question, please let us know if you require any further assistance.

Regards,
Arnel C.
n/a Points
2015-09-13 3:14 pm

I have this error can anyone help? My php memory limit is already at 512MB.

 

PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 30 bytes) in /var/www/html/admin/libraries/BMO/DialplanHooks.class.php on line 0
Staff
40,817 Points
2015-09-21 1:37 pm
Hello Andy,

Have you tried increasing it just a bit more?

Kindest Regards,
Scott M
n/a Points
2015-09-27 3:23 pm

Scott, Yes i have tried increasing it, same result.

n/a Points
2016-01-19 6:33 pm

Hello Scott thank you alot ! and sorry by my poor english

i fix this error  by tried increasing memory more times :) as you said i am usin xampp

n/a Points
2015-09-17 1:05 pm

hello,

i have this problem but if i change this numbers, only a few of my files on my website, even if i increase my memory, and it are just exel files 

Staff
26,229 Points
2015-09-17 5:50 pm
Hello Tom,

Thank you for contacting us. Make sure you are making the file recursive, as explained in Step 5 above. This allows the rule change to affect the child folders as well.

A phpinfo page can help determine if the change was made.

If this does not help, let us know the full errors you are getting.

Thank you,
John-Paul
n/a Points
2015-09-23 1:02 am

Dear Team

We are running a script of facebook sdk in one of our server and that is always giving an error of memory that is mentioned below :

 

Click on this URL and refresh it : https://www.websocialite.com/facebookwebs/

Errors is below :

helloFatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 1145367209 bytes) in /home/websocialite/public_html/facebookwebs/src/facebook-sdk-v5/autoload.php on line 80

We have run the similar script on other servers also and there it is running...

Other server links are :

http://fbstreet.com/facebook-web/

http://attractiveprojects.in/facebook-web/

 

We know that it is coming due to some server settings in whm, please suggest us for the linux server settings for this issue. It is very urgent...

Staff
35,822 Points
2015-09-23 2:29 pm
Hello Brahm Pratap Rana,

Sorry for the problem with the SDK. The error you're showing indicates it's running on a Godaddy server (with whom we are not associated). However, you may want to try changing the php.ini file that is local to that domain on your web server. The steps described above would be what you need to make that change (most likely to memory limit). In addition, you may want to make the php.ini file recursive using the .htaccess setting for the domain. If you don't have a PHP.INI file then you may want create one or speak with your host's tech support to obtain one.

I hope this helps to answer your question, please let us know if you require any further assistance.

Regards,
Arnel C.
n/a Points
2015-09-24 12:36 am

Dear Arnel

I would like to inform you that this is not Godaddy Server, it is dedicated server which we are managing from our end and if we increase the memory limit thru whm panel then it again says to increase more, I mean to say that it again and again after each refresh of the page ask us to  increase the memory like this way i.e (tried to allocate 1145367209 bytes).

So kindly confirm us if we will make the php.ini file recursive then this error will not come.?

Also confirm us that our server administrator could make the php.ini file recursive or any programmer will make it??

 

Waiting for your urgent reply please and thanks for your support.. 

 

Staff
40,817 Points
2015-09-24 9:09 am
Hello Brahm,

If you are using Apache server then making the php.ini recursive can be done by anyone who has access to the cPanel. We have an article on how to make php.ini recursive here.

Kindest Regards,
Scott M
n/a Points
2015-09-26 2:43 am

Dear Scott M

We have go through your article and make the php.ini file recursive but still same memory error is coming and if we increase the memory limit then again after refresh it says us to increase more and more.

Please see the below url where error coming :

https://www.websocialite.com/facebookwebs/

Error : hello

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 3587419385 bytes) in /home/websocialite/public_html/facebookwebs/src/facebook-sdk-v5/autoload.php on line 80 " 

After doing the php.ini file recursive, please check below php info page which we did after your suggestion but still the above error coming..

 

Kindly suggest us best possible solution as we are having dedicated apache server..

https://www.websocialite.com/facebookwebs/php_info.php

in the.htaccess file in line no. 65 : this we have putted :

suPHP_ConfigPath /home/websocialite/public_html/php.ini

Waiting very urgent please..

 

 

Staff
40,817 Points
2015-09-28 1:31 pm
Hello Brahm,

I am at a loss as to the specific cause of your issue. I would look into the server itself but cannot as you are not one of our customers. You may want to check with your host's support team and see if they can assist by looking into your account on their server.

Kindest Regards,
Scott M
2015-12-31 4:00 pm
I have changed my memory limit to:

memory_limit = 512M

I have entered a line in

C:\HostingSpaces\admin1\theoffice.la\wwwroot\Wood\.htaccess

suPHP_ConfigPath C:\HostingSpaces\admin1\theoffice.la\wwwroot\Wood

I have tried removing the C:

I am still getting the error:

<b>Fatal error</b>: Allowed memory size of 268435456 bytes exhausted (tried to allocate 40894441 bytes) in <b>C:\HostingSpaces\admin1\theoffice.la\wwwroot\Wood\wp-content\Plugins\better-wp-security\modules\free\backup\class-itsec-backup.php</b> on line <b>228</b><br />

I see in PHP info
memory_limit512M

Do you have any suggestions on how to fix it?

Thank you,
Docfxit
Staff
26,229 Points
2015-12-31 5:14 pm
Hello Docfxit,

Thank you for contacting us. If you are hosted on our servers, I recommend using a phpinfo page to verify the changes were made.

Thank you,
John-Paul
2015-12-31 9:06 pm
I see in PHPInfo that the memory_limit = 512M
I don't know where to look to see if the recursive is working.

Thanks,
Docfxit
Staff
40,817 Points
2016-01-04 9:28 am
Hello Docfixit,

To test the settings, you would need to set a phpinfo page in a folder under the one that has the php.ini file. If the setting shows up correctly, that proves the file is recursive.

Kindest Regards,
Scott M
n/a Points
2016-01-04 11:20 pm

Thank you for you reply...

I'm not sure how to do what you are suggesting. 

My web server is at:

Path#1 + \wwwroot\PHPInfo.php   (not the real file name)

My php.ini file is at

Different path#2 \PHP\php.ini

I have an environment variable with the path to the php.ini file.

Could you please give me an example of what path I would put the PHPInfo.php file in and how can I set the URL to run it.

Thank you,

Docfxit

Staff
6,526 Points
2016-01-05 8:37 pm
A recursive file affects the directories beneath it. Make sure the files you want you hope to affect are in the same directory or subdirectories of the php.ini file.

The path you will take to the phpinfo.php page would be the same as the example you provided -- with the correct domain and file path of course.

Beyond that I'm not sure what part of Scott's reply you were having trouble with. From the examples you provided it seems you have the right idea.
2016-01-07 11:31 am
Thank you for the reply...
I think I didn't make it clear enough in my last reply. Or I really need an example on how to do this.

My web server is at:
C: \wwwroot\PHPInfo.php (not the real file name)
My web pages are at:
C:\wwwroot\wood\webpages
My php.ini file is at
C:\PHP\php.ini
Are you saying I need to install PHP.ini into C:\wwwroot\wood\webpages
"Make sure the files you want you hope to affect are in the same directory or subdirectories of the php.ini file"
Even though I currently have PHP installed in C:\PHP\php.ini
are you saying I should move the php.ini file into the webpages folder?
Please give me an example of what this should look like.
Webpages folder - domain installed
PHP installed folder
php.ini file

Thank you,
Docfxit
Staff
26,229 Points
2016-01-07 5:10 pm
Hello docfxit,

Thank you for contacting us. To test if the changes you are making in the php.ini file are recursive, create a phpinfo page in a folder for your website. For example: C:\wwwroot\wood\webpages\folder-name (be sure to replace "folder-name" with the name of your actual folder).

But, keep in mind our guides are geared toward people who are hosted on our servers, so your specific configuration may differ. For example, some PHP handlers do not support .htaccess rules. If you are not sure which handler you are using, here is a link to a similar question.

Thank you,
John-Paul
2016-01-07 11:36 pm
Thank you for the example.
I now have the phpinfo.php page in a folder called C:\wwwroot\wood\webpages\wp-admin
What should I see in phpinfo.php to know that it is setup correctly to be recursive?

Thank you,
Docfxit
Staff
10,077 Points
2016-01-08 10:46 am
Hello Docfxit,

If you make changes to the php.ini file that would be located around this area (C:\wwwroot\wood\webpages) and it shows up in that phpinfo.php file then the recursive is setup correctly.

Best Regards,
TJ Edens
n/a Points
2016-01-11 4:11 pm

Hi!

We have completed these steps and unfortunately it seems we are still being limited somewhere.We need to increase Max post size in addition to memory, so we have this in our php.ini:

memory_limit = 512Mpost_max_size = 512M

When we do a test of our php info, these limits show up as what we have, however the Revolution Slider plugin is still reading that we are limit at this...

memory_limit = 512Mpost_max_size = 8M

The post Max Size at 8 is the major issue. We have contacted the Revolution Slider support, and they said this is happening on our end and that we need to contact In Motion to see where this is limited still. We are VPS customers, so we should have more than enough space/limit on our hosting plan to allow what we are trying to do

Staff
40,817 Points
2016-01-11 6:17 pm
Hello Jenna,

You will want to be sure your php.ini file is set to recursive, otherwise the settings will only work in that folder.

Kindest Regards,
Scott M
n/a Points
2016-01-18 10:02 pm

Hi,

We actually already had it set to recursive, as we mention we completed all of the steps in this article :) We ended up calling In Motion support and they had to have a tier 2 tech adjust some additional settings. It was being limited somewhere else aside from the php.ini For some reason it's still being limited though. :( We're VPS customers, to avoid this kind of issue with memory limits so we're a little frustrated.

n/a Points
2016-01-14 2:02 pm

This can be fixed in:

WHM > Service Configuration > PHP Configuration Editor > memory_limitSet it to 512M

n/a Points
2016-01-18 10:14 pm

Hi!

KingKislev, we don't have those same options in our WHM. We have 'Server' Configuration' but not 'Service Configuration', and 'Server Configuration' doesn't lead to a 'PHP Configuration' option :(

When we go into our CPanel we can locate a 'PHP Configuration' option, but we're not allowed to edit it, and we can see that the memory limits in that are are less than what we have designate in our php.ini file.

Grr. In Motion is limiting us somwhere, and even after calling support we're still limited. Anyone else know where we can access these limits and increase what InMotion is limiting us at?

Thank you!

Staff
6,526 Points
2016-01-19 9:48 am
Hello Jenna, are you logging into WHM as user "root" or as reseller? If not, do you have root access? If there are any options you are not seeing in WHM then privileges are the likely explanation. If you have a VPS or Dedicated plan you can request root access.
n/a Points
2016-01-19 2:04 pm

Ug. Beyond frustrating. We have had 2 phone calls with support this week regarding this issue where we have drilled the heck out of the techs trying to find out how to solve this limitation issue and we're outright told...

"The php.ini file is all there is, there is nothing else I can help you with."

Last night we were given that exact response despite showing them this article and pushing for additional options regarding server configuration. We were incredibly persistent, and they basically told us we were confused and this didn't exist.

Why would they not just tell us of this root access? We have been VPS customers for 4 years. Why the run around?

Staff
6,526 Points
2016-01-19 6:51 pm
Sorry for the confusion. We certainly don't intend to hide anything from our customers or put you through multiple Support contacts. I hope the article on root access helped you understand how user privileges work.
n/a Points
2016-01-22 12:00 am

Hi,

Our account now says that we have been enabled root access, however our WHM isn't any different :\ So we still don't have the options that KingKislev describes:

WHM > Service Configuration > PHP Configuration Editor > memory_limit

We're so confused?? It feels like someone at InMotion is intentionally trying to not let us increase our memory :( Why is this so hard lol?? Can anyone help us? Phone support has been insanely frustrating and states this option we are seeking is an imaginary unicorn in neverland.

Staff
10,077 Points
2016-01-23 3:17 am
Hello Jenna,

Are you sure you are logging in with the Root user as in using root as the username and the password would be the one from the AMP.

Best Regards,
TJ Edens
n/a Points
2016-01-27 4:21 pm

Hi,

 

We're legitimately so confused at this point. We requested root access. We were then sent to a screen that said "Your reqest has been submitted". Nothing ever appened after that. No notification, no email, no steps on what to do next. So we called support again, and they said "Root access is enabled". So we look into our account, and the "Reset Root Access Password" icon is there, but we never recevied anything regarding a first access that we would need to reset?. So we reset the password, and then we login to WHM using that password, with our original user, and it logs us in, but again, WHM still looks the same as it did prior to requesting root acess. That option we are trying to find is not there :( We feel like we're going in a million circles, and phone support doesn't seem to be informaed about your root access. We're so lost :( Is there any we can contact you specifically through a support ticket? This is crazy frustrating at this point.

Staff
35,822 Points
2016-01-28 8:31 am
Hello Jenna,

We're sorry to hear that you're confused about using the Root access. Sometimes, it's hard to visually understand it if you have never used root access on your account before. Literally, "root" is the user name you should be using to login to the server. You should have received the password to login to root. Root access is given only upon request, but no information is provided with it's use because it provides COMPLETE access to your system. There's too much that you can do with it which makes it very difficult to provide instructions on its use. You can use this tutorial to see a short list of things you can do with root access. Bear in mind that due to the "power" of root access, you should be cautious if you're not familiar with using it. If you need some specific done that you are not familiar with, you can still request it through live technical support via email/phone/chat.

The support center team is separate from the live technical support team. If you have any questions that require immediate attention, please contact our live technical support team. You can also post questions or leave comments on the website.

I hope that helps to answer your questions! If you require further assistance, please let us know!

Regards,
Arnel C.
n/a Points
2016-02-03 9:56 pm

Hi Arnel,

 

I think this is the issue, we were never sent any information regarding the root access. No email, no notice, no password, no user, etc. When we called phone support they were clearly uninformed on their end as they told us there was no separate access and to just login to WHM with our main account user. :( So Phone support doesn't appear to be up to speed on this.

 

Staff
26,229 Points
2016-02-04 11:38 am
Hello Jenna,

Thank you for contacting us. Sorry to hear about your experiences. Our Support team (on all levels) should be familiar with root access, and we will follow up with the specific associates you contacted recently.

I confirmed your request for root access was received, and provisioned on "2016-01-19 13:05:41" and an email (including your root password) should have been sent to your primary contact email address. You can view, or update your email address in AMP at any time. I also recommend checking your spam box, as it may have been flagged by email filters.

Thank you,
John-Paul

n/a Points
2016-01-31 8:00 pm

Enter "PHP Configuration Editor" in the search box in WHM, can you confirm nothing comes up?

n/a Points
2016-01-27 3:09 am

Jenna, if they enabled root access it means they added your user account to the "wheel group", so you can access root files and folders in SSH. It doesn't mean you can log into WHM as root, you still need the password for the user "root" to log in to WHM then you'll be able to see those settings I mentioned. You can still do the same via SSH, but it's a bit more complex.If you have a VPS then I don't see why you shouldn't have the root access in WHM.

n/a Points
2016-01-20 2:27 am

My memory seems to be set at a huge max (found it like this)  What do I do?

magic_quotes_gpc = Off;

register_globals = Off;

default_charset= UTF-8;

memory_limit = 64M;

max_execution_time = 36000;

upload_max_filesize = 999M;

safe_mode = Off;

mysql.connect_timeout = 20;

session.auto_start = Off;

session.use_only_cookies = On;

session.use_cookies = On;

session.use_trans_sid = Off;

session.cookie_httponly = On;

session.gc_maxlifetime = 3600;

allow_url_fopen = on;

;display_errors = 1;

;error_reporting = E_ALL;

Staff
11,946 Points
2016-01-20 7:56 am
It appears your memory level is set to 64M which is standard, and not considered high at all. Was there another setting you were referring to?
n/a Points
2016-01-26 9:58 pm

I did as you recommended (thank you).  However, prior to that I DID find two files that were humongous in the directory on the website.  I deleted the two of them and was then able to upload pictures.  I had no idea those were as big as they were when i uploaded them.  Thank you very much for your response.  I sincerely appreciate it.  I hope to turn to this group again if I need help later... (probably will)

n/a Points
2016-02-12 3:57 am

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 49152 bytes) in /home/..../public_html/files.php on line 83

 

since updating to php 5.6.17, this fatal error apperars, how can I solve it?

Staff
10,077 Points
2016-02-12 10:43 am
Hello Bob,

What happens if you switch back to 5.5 as something within your code is not working with the current version.

Best Regards,
TJ Edens
n/a Points
2016-02-17 4:16 pm

Hi dear,

My website is working fine, but when I'm going to upload something it's just showing

"Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 20216 bytes) in public_html/www..........com/system/library/image.php on line 26"

 

Do you have any suggestion to fix this problem?

I already have changed the php.ini and increased the memory limit. but still showing that. My website is based on Opencar and running Journal2 theme.

Thank you

Staff
35,822 Points
2016-02-18 7:31 am
Hello Mostak,

You said that you changed the PHP.INI, but what exact setting? There's also a max file upload size setting. Additionally, make sure that the PHP.INI file that you're modifying is the one inside the folder of the website that's running. There can be multiple PHP.INI files.

I hope that helps to answer your question! If you require further assistance, please let us know!

Regards,
Arnel C.
n/a Points
2016-02-18 9:37 am

Hi dear,

I fixed the problem, I used the search bar and search all file "php.ini" and edit memory_limit = 64M to memory_limit = 256M. And its all fixed.

And I have got another solution from opencart suport team. They said Delete the last file and use FTP uploder to upload. I aplied both of them. Now my website is working well.

But I think the firss solution is best.

Thank you all.

n/a Points
2016-05-03 10:40 pm

All you have to do to fix this is change your PHP version via cPanel.

With some hosts, this is VERY simple.

  1. Simply login to cPanel and under the "software" section, click "Select PHP Version".
  2. Then change it to the latest version of PHP. In my case, the default was 5.3 and I changed it to 5.6 via the dropdown options
  3. then click "set as current".
Staff
35,822 Points
2016-05-04 12:05 pm
Hello Heath,

Thanks for your comment - check out How to Change your PHP version for more information.

If you have any further questions or comments, please let us know.

Regards,
Arnel C.
n/a Points
2016-07-04 6:36 am

Didn't help even memory_limit = 600M...

Staff
11,946 Points
2016-07-05 7:07 am
If you need more than 600MB of memory you may have a memory leak. These can be difficult to troubleshoot. Do you know the cause of needing so much memory?
n/a Points
2016-10-06 2:05 am

Hi,

I am getting a Fatal Error While Uploading the File That file exhausted memory limit error but after while i check the result the file is uploaded, how remove this error

 

Staff
26,229 Points
2016-10-06 11:07 am
I recommend enabling error reporting, as there may be additional problems occurring. This may provide more detailed clues into the issue.

If you are using a CMS (such as WordPress, Drupal, Joomla, etc.) you can put them in debug mode in the config file, or enable error reporting in the dashboard.

Thank you,
John-Paul
n/a Points
2016-11-08 7:11 am

Forget all this man. 

just use this in your php script where you getting the error.

ini_set("memory_limit","150M");

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.

65 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!