Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Fix: WordPress Memory Exhausted Error – Öka PHP-minnet

Ser you an allowed memory size exhausted error message i WordPress?

Det här är ett av de vanligaste WordPress error, och du kan enkelt fixa det genom att öka PHP-minneslimiten i WordPress.

I den här artikeln kommer vi att visa dig hur du fixar WordPress memory exhausted error genom att öka PHP:s memory limit.

Fix: WordPress Memory Exhausted Error – Increase PHP Memory

Vad är WordPress Error om minne uttömt?

WordPress memory exhausted error är ett message som du kan se om din website har svårt att utföra sina uppgifter.

WordPress är built-in med PHP, ett programmeringsspråk på serversidan som behöver minne för att kunna run.

Precis som alla andra datorer har web servers en limit av minne för att kunna run flera applikationer kl. samma tid. WordPress hosting providers tilldelar specifika minnesstorlekar till olika applikationer, inklusive PHP.

När din WordPress-kod är obligatorisk och kräver mer minne än vad som tilldelats som standard, visas detta message:

Fatal error: Allowed memory size of 33554432 bytes exhausted (försökte allokera 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

Memory exhausted error displayed on a WordPress site

Din WordPress site kan ha förbrukat minnet på servern om den har gjort det:

  • Många images, videoklipp och andra typer av media
  • Massor av oanvända tillägg till WordPress
  • Växte ur sina resurser för webbhotellets plan

Som standard försöker WordPress automatiskt att öka PHP:s minneslimit om den är mindre än 64 MB. Men 64 MB är ofta inte tillräckligt högt.

Med detta sagt, låt oss se hur du enkelt kan öka PHP:s minnes limit i WordPress för att undvika error om att minnet är förbrukat.

Du kan använda snabblänkarna under för att navigera genom tutorialen:

Note: Några av dessa metoder kräver att du direkt editerar dina WordPress-filer. Vi föreslår att du säkerhetskopierar din website först för att undvika att ytterligare error dyker upp på din website.

Alternativ 1: Editera wp-config.php-filen

Först måste du editera wp-config.php-filen på din WordPress site. Detta är en av WordPress core-filer som ligger i rotkatalogen, vanligtvis public_html.

Du måste använda en FTP-klient som FileZilla eller filhanteraren i webbhotellets kontrollpanel.

Följaktligen måste du klistra in följande rad i wp-config.php-filen precis före den som säger, That's all, stop editing! Trevlig bloggning.

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

Den här koden säger till WordPress att öka limiten för PHP-minnet till 256 MB.

För mer details, se vår Step-by-Step guide om hur du hittar och editerar wp-config.php filen.

När du är klar måste du save dina ändringar och uploada din wp-config.php-fil tillbaka till din server.

You can now visit your WordPress site, and the memory exhausted error should have disappeared.

Alternativ 2: Editera .htaccess-filen

Nästa metod är att editera .htaccess-filen. Denna fil är också placerad i WordPress-webbplatsens rotfolder.

Här måste du klistra in följande kod före raden där det står #END WORDPRESS.

php_value memory_limit 256M

På samma sätt som den tidigare koden kommer den att berätta för WordPress att öka PHP-minneslimiten till 256 MB.p

Därefter sparar du dina ändringar och uploadar filen tillbaka till din web server. You can now open your WordPress website again to see if the memory limit error has gone.

Om du inte kan hitta .htaccess-filen, kontrollera vår guide om varför .htaccess-filen kan saknas och hur du hittar den.

Alternativ 3: Kontrollera din php.ini-fil

Om metoderna ovan inte fungerar kanske du vill ta en titt på filen php.ini.

php.ini är en fil som kontrollerar dina PHP-inställningar, inklusive PHP-versionen och PHP-skript. Det är inte en WordPress core-fil, eftersom din hosting provider vanligtvis hanterar den.

Du kan kontrollera dess kod för att se din limit för minnesanvändning i PHP. För mer detaljer, kan du se vår guide om hur du hittar och editar php.ini-filen.

Men eftersom det här är en avancerad metod rekommenderar vi att du istället kontaktar supportteamet hos din hosting provider för att se om de kan öka WordPress memory limit manuellt. Annars kan detta leda till ytterligare error.

Du kan läsa vår guide om hur du på rätt sätt ber om support för WordPress för mer information.

Alternativ 4: Upgrading to your WordPress webbhotell

Om du konstant stöter på error om att minnet är uttömt kan det vara ett tecken på att din website har vuxit ur sin nuvarande plan för webbhotell.

När din website lockar fler besökare och adderar mer content blir det obligatoriskt med mer resurser för att den ska fungera smidigt. Upgrading till en plan med en högre minnesallokering kan vara en permanent lösning.

Överväg att uppgradera ditt WordPress webbhotell om:

  • Du har provat de tidigare lösningarna och error kvarstår.
  • Your website har ökat betydligt i trafik eller content.
  • You plan to add features or functionality that require more resources.

Bluehost erbjuder prisvärda och tillförlitliga WordPress webbhotell planer som kan skala med din webbplats behov. De tillhandahåller en användarvänlig plattform som är särskilt optimerad för WordPress, vilket gör det enkelt att hantera din website.

Om du använder vår Bluehost coupon code, då kan du få upp till 61% rabatt på ditt första köp. Klicka bara på knappen under för att få det:

Bluehost offer for WPBeginner readers

Så här undviker du att trötta ut ditt minne i WordPress

Nu när du har fixat WordPress error med uttömt minne, följer här några proaktiva steg för att förhindra att det händer igen:

  • Deactivate oanvända tillägg. Många tillägg bidrar till minnesanvändningen. Se regelbundet över dina installerade tillägg och deaktivera dem som du ej aktivt använder för att gratis frigöra minne för viktiga uppgifter.
  • Optimera images. Stora images kan sluka mycket minne. Överväg att använda ett plugin som EWWW Image Optimizer för att automatiskt komprimera images innan du uppladar dem till din site.
  • Använd ett plugin för caching. Tillägg för caching lagrar data på webbplatsen, vilket minskar behovet av att WordPress återskapar den vid varje besök. Detta kan avsevärt förbättra website-prestandan och minska minnesanvändningen.

Vi hoppas att den här artikeln hjälpte dig att lösa error med WordPress minne uttömt genom att öka PHP:s minnes limit. Du kanske också vill se vår Step-by-Step Beginner’s Guide till felsökning av WordPress error och våra expertval för de bästa WordPress-tilläggen för att utveckla din site.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

464 kommentarerLämna ett svar

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. rahul

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 262198 bytes) in /home/content/p3pnexwpnas04_data01/91/3161991/html/wp-content/object-cache.php on line 574

  3. Bijay Budhathoki

    It Worked for me when i changed the following

    define(’WP_MEMORY_LIMIT’, ’264M’);

  4. Gus

    Thanks! Worked like a charm! I tried 64M and did not worked, then I tried 512M and worked. Note: I always makes notes on my files for future reference, so I noticed that for some weird reason, when I wrote a note it did not worked, I removed the note and worked … I know! it is weird, but I am just sharing my weird experience in case this happens to someone else.

  5. Brian

    It really worked like a charm on my site One thing i am beginning to learning about wordpress. Have you FTP app open and ready when handling any upgrades or plugins installs

  6. ussy

    worked for me
    Thanks
    I increased it to 512M

  7. Muhammad Farooq

    Sometimes 64M also doesn’t work try to change it to 128M, then it will work fine.
    Thanks for sharing this awesome info :)

  8. Troy Vayanos

    I’ve been getting this error for a couple of weeks now and my host continually increases the memory but it still occurs when I’m doing updates and going in and out of my WP dashboard.

    Error below:

    Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 96 bytes) in /home/vwa9843/public_html/example.com/wp-includes/wp-db.php on line 1833

    I’ve checked the plugins and they are all low of memory they take up.

    Is there any other solution I could try?

    Thanks

  9. Pascal mutulu

    Thanks,
    define(’WP_MEMORY_LIMIT’, ’64M’);
    It worked for me in a second after 1week hustle.

  10. Tuấn

    thank you so much, you are save my life, it’s worked like a charm!!

  11. Avtar Nanrey

    You’re a life saver. Thank You.

  12. Olagoke Tobi

    Thanks guys, worked like a charm!!!!!

  13. Naveen Rishi

    Nice buddy, Thanks

  14. RetroMike

    Nice one! Instafix :)

    (well… after opening loads of other tabs and not doing it for 10 minutes…)

  15. Shubham Singh

    I’m getting this problem..please help me wp beginner..

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 786432 bytes) in /home/mom14isgod/public_html/wp-includes/SimplePie/Item.php on line 2736

  16. JK

    Howdy,

    Where exactly should I place this in the wp-config.php file? Under what? Before what?

    Please help – I think this issue has made me a bit more insane!

    Ta
    JK

    • WPBeginner Support

      You should paste this code just before the line ”/* That’s all, stop editing! Happy blogging. */”

      Administratör

  17. sajid

    sir i am trying to upload images in wordpress directory but after add images in wordpress page its not showing and also showing 404 error can you tell me the reason ?

  18. Sarah

    Problem: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) ..

    Solve: I sovle It

    step 1. Login Cpanel

    step 2. Go to Web root (public_html/www) click GO

    step 3 find php.ini OR .htaccess file

    edit php.ini OR .htaccess file

    max_execution_time = 30
    max_input_time = 60
    memory_limit = 128M

    TO

    max_execution_time = 30
    max_input_time = 60

    memory_limit = 512M

    Then solve my error.

    If any body face problem please contact me at

    • Shah Nasir

      Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 18 bytes) in /home/unlockingportal/public_html/wp-content/plugins/Ultimate_VC_Addons/modules/Ultimate_List_Icon.php on line 147
      plz fix this i tried so many times with ur instructions but still i face same problem

    • Smith

      I solve my problem flow your note but one more problem if you provided your contact i will helpfulness

    • faisal

      hi. i have facing some issue with word press online. i worked locally on my machine then upload online, everything working fine, but my theme not editable online.

      HTTP ERROR 500

    • john

      hello mate im having this problem with my wordpress can you help i already tried that what you post. best regards

    • Gabriela

      I can’t find my .htaccess or php.ini file in CPanel :( Help!

      • Anonimos

        There’s a window open when you click on cpanel file explore, tick dot show hidden file

    • Alpesh Desai

      Bro I searched this but not found
      php.in

      and Found
      .htaccess

      but not showing memory limit please email me

    • hassan

      i increased the size but notning happens

    • saad

      i had put up in the wpconfig.php
      define(’WP_MEMORY_LIMIT’, ’512M’); still i am facing the problem
      please help me out

  19. Jhasketan Garud

    Thanks a lot . It just saved me from a 503 error as well.

  20. aqib

    i am getting this eror when i publishig new post
    ”Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77 bytes) in /home/veri85fa/public_html/wp-content/plugins/wordpress-23-related-posts-plugin/recommendations.php on line 57
    plz give sloution to fix this

  21. Ahmed

    i don’t know how to thank you, i spent the whole day tryig to figure out what’s the problem with my site until i found this simple ”memory increase” solution.

    THANK YOU

  22. Erick Ferrari

    Thanks WP Beginner!

    It worked great with my website.

    As a suggestion: This happens due to the over usage of memory.

    In my case I had too many Plugins installed in my website.

    I deleted the unused plugins as well and the memory problem was solved easily.

    If you are planing for a robust website it is better to extend the memory on the config.php as you start to build the website.

    Thanks

    Erick

  23. Mos

    Hello,
    How do identify the main php tag?
    Thanks!

  24. Christian

    Sweet! Worked perfectly. Thanks!

  25. gopi

    front-end is working fine but when open the back-end i tried to access the menu section under appearance but when i clicked on it, it shows the Fatal Error of Memory exhausted.
    The error is

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 72 bytes) in /home/yyyyyy/public_html/yyyyyy.com/wp-includes/meta.php on line 838

    Please help me in this regard.

  26. sandy

    I got this error when trying to install wordpress does anybody got in solution.

    Fatal error: Maximum execution time of 30 seconds exceeded in F:\xampp\htdocs\site1\wordpress\wp-admin\includes\misc.php on line 105

    thank you
    sandy

  27. Aldaz

    New to word press how can I fix the following, any help is much appreciated.

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 6785803 bytes) in /home/content/p3pnexwpnas10_data01/69/2702869/html/wp-content/object-cache.php on line 574

  28. Gerhard

    Also had the memory limit problem on edit.php for a custom post type. Found out that if the CPT is hierarchical wp loads all posts so if you dont need it to be hierarchical set it to false in the declaration.

    greets gerhard

  29. Lindsay

    Worked like a charm! Thanks for the super simple fix!

  30. Dani

    Thanks Sabi Hussain, it just fixed my problem. I saw every forum all adressing the same problem, I have 512M allowed with my server, and define in config.php for 128M but it wasn’t working till I saw your comment, best tip ever. It was overwriting what I define in config.php. Thanks a lot!

  31. David

    Please how do I locate my Root WordPress Directory. Please explain with images to help me understand better. Thanks

  32. Ashlee

    Hi;
    Supposed to be updating today and got the white screen of death. Went into wp-config.php and changed debug status to true which then popped up with this message. I’ve added the suggested code of both 64 and then 128. This is not working and my host says there is nothing they can do? They keep saying that i’m well below my capacity on my hosting account. I’m not sure they completely understand the issue? Is it something in regards to WordPress that they have to change or does it have to do with my memory space on their server.
    I hope this article isn’t too old and you can response quickly.
    – Ashlee

    • Doug

      Hi Ashlee,

      If you have already changed your wp-includes/default-constants.php file, it could be the server. If you have access to WHM or a developer does who can change settings like max file size for upload.
      For example, if you are having issues with uploading files to WordPress because of their size this can be changed in WHM under Service Configuration > PHP Configuration Editor. You would want to change the upload_max_filesize field from 2M (default) to whatever file size you need.

  33. Kenold Beauplan

    128M worked for me.
    Thanks

  34. lootoffers

    Fatal error: Cannot redeclare win_is_writable() (previously declared in /home/u805727311/public_html/wp-includes/functions.php:1684) in /home/u805727311/public_html/wp-admin/includes/misc.php on line 557

    Please solutions

  35. Sabir Hussain

    so simple
    check this file
    public_html/wp-includes/default-constants.php

    Enjoy

  36. Dong

    sorry but the suggested solution is not a fix for me.

    I am using a w3 cache plugin but it was not the culprit.
    I’ve increased memory in php.ini and wp-config.php to 512MB and I still get the Fatal error.

    the workaround was to stop non-important plugin and so far the site is OK (temporarily)

  37. Victoria Miller

    Thanks SO much!

    I had created a child theme (my first) and couldn’t understand why just trying to Customize the Appearance in dashboard would cause a Server error. This fix define(’WP_MEMORY_LIMIT’, ’128M’); did the trick!!!!

  38. Alinn

    Thanks a lot :)

  39. mrunmay phanse

    Hey it worked awesome for me…… and thanks to that person who added 128m in comment… i used that tag and it worked =D thanks

  40. Kim

    Hi Everyone – Is there a fix for this exact same problem, except instead of ”/wp-includes/plugin.php” at the end of the error it’s ” /file.php” ?
    I’m still getting the error and I”m unable to update anything on my site. Thanks so much!

  41. Kassiah

    Thanks for this great tip! Worked like a charm :)

  42. Saskia

    I have a white screen and cannot open the items in the wordpress directory (only SEO and guestbook). How to increase the memory?

  43. Alex

    Hi guys,

    This method can be use to fix the ”508 Resource Limited Reached” Problem?

    Thank You

  44. Pete Trenery

    Thanks for the great tip – worked a treat.
    Unfortunately all we got after an initial upgrade to WordPress was the WSOD when attempting to login and edit our website.
    Your steps were clear and solved our issue – now able to access via admin login again.

  45. Henry

    its great thanks , it worked after increase the memory limit up to 128mb

    define(‘WP_MEMORY_LIMIT’, ‘128M’);

    • Jessica

      This worked for me, thanks a bunch everyone!

  46. Abdul Qayoum

    I installed a wordpress template and then demo content. After that i tried to access the menu section under appearance but when i clicked on it, it shows the Fatal Error of Memory exhausted.
    The error is

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 28593220 bytes) in /home/xxxx/public_html/xxxxxx.com/wp-admin/includes/nav-menu.php on line 1198

    Please help me in this regard.

  47. Anriëtte

    Had a strong suspicion this won’t work for my host, but it did, thanks! :)

  48. Phil

    Perfect

    added
    128mb to remove error as short term solution
    contacted hosting to see if there needs to be a longer term answer also getting php versions updated as well

    added on top line after php tag
    /** Memory Limit */
    define(’WP_MEMORY_LIMIT’, ’128M’);

  49. tegori.org

    brilliant! thanks for this. I had to increase the limit to 256M, but it worked like a charm.

  50. Kasra Khosravi

    Thanks for the great article. I encountered this problem and I used a setting in ”All in One SEO Pack” to increase the memory limit.

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.