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 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 located in the public_html. The following steps will explain how to set the php.ini to allow a larger amount of memory use.
- Login to cPanel.
- Go to the File Manager, or FTP/SSH into your server.
- Select the Web root (public_html/www) directory and click Go.
- 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 the php.ini to your public_html directory.Open the php.ini file with a code editor.
- Find the following section in the php.ini file.
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
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.
- 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 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 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 to have them look into the error further.
Go on admin folder search php.ini change memory_limit = 64M to 256M it will work
Thanks
It working for me , i m suffered this problem till last day.
Thank u soo much
HI
i was trying to install a theme in magento 2,after tranferring the file ,run the upgrade command via SSH,i was getting below error
Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory [email protected]
HOW do i resolve the error
I have the same issue with my server and no one can help. Here is the problem:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /home/ctestcoa/public_html/app/code/core/Mage/Adminhtml/Helper/Dashboard/Order.php on line 48
Hello Francis,
I’m sorry to hear that you’re having problems with Magento because of memory issues. The Magento community has discussed this problem before. Here’s an example of one such post. Have you tried the steps in the article above? If you continue to have the problem, please provide us more details on your installation such as any steps taken to try to correct the issue, version of Magento, and account information so that we may take a look.
If you have any further questions or comments, please let us know.
Regards,
Arnel C.
Forget all this man.
just use this in your php script where you getting the error.
ini_set(“memory_limit”,”150M”);
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
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
Didn’t help even memory_limit = 600M…
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?
All you have to do to fix this is change your PHP version via cPanel.
With some hosts, this is VERY simple.
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.
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.
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
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.
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?
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
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.
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
Enter “PHP Configuration Editor” in the search box in WHM, can you confirm nothing comes up?
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.
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.
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.
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)
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.
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
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;
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?
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
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.
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?
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!
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.
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.
This can be fixed in:
WHM > Service Configuration > PHP Configuration Editor > memory_limit
Set it to 512M
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 = 512M
post_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 = 512M
post_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
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
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
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.
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
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:wwwrootwoodwebpagesfolder-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
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
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
Scott, Yes i have tried increasing it, same result.
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
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:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 40894441 bytes) in C:\HostingSpaces\admin1\theoffice.la\wwwroot\Wood\wp-content\Plugins\better-wp-security\modules\free\backup\class-itsec-backup.php on line 228
I see in PHP info
memory_limit512M
Do you have any suggestions on how to fix it?
Thank you,
Docfxit
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
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
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
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..
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..
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
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 :
hello
Fatal 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 :
https://fbstreet.com/facebook-web/
https://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…
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.
Scott,
Yes i did increase the memory, it is still giving me the same error.
Hello Andy,
Have you tried increasing it just a bit more?
Kindest Regards,
Scott M
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
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
I have this error can anyone help? My php memory limit is already at 512MB.
Hello Andy
Have you tried increasing it even more?
Kindest Regards,
Scott M
Hi,
In the file wamp\alias\phpmyadmin.conf just before </Directory> insert four lines below to obtain:
With this, I managed to import large SQL files. The largest file I actually imported was 278 MB
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.
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
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
I agree, very helpful article, thanks so much for sharing
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!