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

Poprawka: Błąd wyczerpania pamięci WordPress – Zwiększ pamięć PHP

Napotkanie błędu “dozwolony rozmiar pamięci wyczerpany” w WordPress może być frustrujące. Jest to częsty problem, który pojawia się, gdy witryna potrzebuje więcej pamięci PHP niż jest to dozwolone.

Błąd ten może spowolnić działanie witryny, a nawet spowodować jej tymczasową awarię. Dlatego też jego szybka poprawka jest tak ważna, aby witryna działała płynnie dla odwiedzających.

Na szczęście istnieje prosta poprawka tego problemu. Zwiększając limit pamięci PHP, można rozwiązać ten błąd i poprawić wydajność witryny.

W tym przewodniku przeprowadzimy Cię przez proste kroki, aby zwiększyć limit pamięci PHP i przywrócić witrynę na właściwe tory.

Fix: WordPress Memory Exhausted Error – Increase PHP Memory

Czym jest błąd wyczerpania pamięci WordPress?

Błąd wyczerpania pamięci WordPress to komunikat, który możesz zobaczyć, jeśli twoja witryna internetowa ma trudności z wykonywaniem zadań.

WordPress jest zbudowany przy użyciu PHP, języka programowania po stronie serwera, który wymaga pamięci do działania.

Podobnie jak każdy inny komputer, serwery WWW mają ograniczoną ilość pamięci do uruchamiania wielu aplikacji jednocześnie. Dostawcy hostingu WordPress przydzielają określone rozmiary pamięci dla różnych aplikacji, w tym PHP.

Kiedy twój kod WordPress wymaga więcej pamięci niż domyślnie przydzielona, zobaczysz ten komunikat o błędzie:

Błąd krytyczny: Wyczerpano dozwolony rozmiar pamięci 33554432 bajtów (próbowano przydzielić 2348617 bajtów) w /home4/xxx/public_html/wp-includes/plugin.php na linii xxx

Memory exhausted error displayed on a WordPress site

Twoja witryna WordPress może wyczerpywać pamięć serwera, jeśli tak się dzieje:

  • Dużo obrazków, filmów i innego rodzaju multimediów
  • Mnóstwo nieużywanych wtyczek WordPress
  • Przekroczenie zasobów planu hostingowego

Domyślnie WordPress automatycznie próbuje zwiększyć limit pamięci PHP, jeśli jest on mniejszy niż 64 MB. Jednak 64 MB to często za mało.

W następnej sekcji pokażemy, jak łatwo zwiększyć limit pamięci PHP w WordPress, aby uniknąć błędu wyczerpania pamięci. Możesz skorzystać z poniższych szybkich linków, aby poruszać się po poradniku:

Uwaga: Niektóre z tych metod wymagają bezpośredniej edycji twoich plików WordPress. Sugerujemy najpierw utworzenie kopii zapasowej twojej witryny internetowej, aby uniknąć dalszych błędów.

Gotowy? Wskakujmy od razu!

Opcja 1: Edycja pliku wp-config.php

Po pierwsze, należy edytować plik wp-config.php w witrynie WordPress. Jest to jeden z rdzennych plików WordPressa znajdujący się w katalogu głównym, zwykle o nazwie public_html.

Będziesz musiał użyć klienta FTP, takiego jak FileZilla lub menedżera plików w twoim panelu kontrolnym hostingu.

Następnie musisz wkleić następującą linię w pliku wp-config.php tuż przed tą, która mówi: To wszystko, przestań edytować! Szczęśliwego blogowania.

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

Ten kod nakazuje WordPressowi zwiększenie limitu pamięci PHP do 256 MB.

Więcej szczegółów można znaleźć w naszym przewodniku krok po kroku, jak znaleźć i edytować plik wp-config.php.

Po zakończeniu należy zapisać zmiany i przesłać plik wp-config. php z powrotem na serwer.

Możesz teraz przejść na twoją witrynę WordPress, a błąd wyczerpanej pamięci powinien zniknąć.

Opcja 2: Edycja pliku .htaccess

Kolejną metodą jest edycja pliku .htaccess. Plik ten również znajduje się w katalogu głównym witryny internetowej WordPress.

W tym miejscu należy wkleić następujący kod przed linią z napisem #END WORDPRESS.

php_value memory_limit 256M

Podobnie jak w poprzednim kodzie, powie on WordPressowi, aby zwiększył limit pamięci PHP do 256 MB.

Następnie zapisz wprowadzone zmiany i prześlij plik z powrotem na serwer WWW. Możesz teraz ponownie otworzyć twoją witrynę internetową WordPress, aby sprawdzić, czy błąd limitu pamięci zniknął.

Jeśli nie możesz znaleźć pliku .ht access, możesz zapoznać się z naszym przewodnikiem na temat tego, dlaczego może brakować pliku .htaccess i jak go znaleźć.

Opcja 3: Sprawdzenie twojego pliku php.ini

Jeśli powyższe metody nie działają, warto zajrzeć do pliku php.ini.

php.ini to plik, który kontroluje ustawienia PHP, w tym wersję PHP i skrypty PHP. Nie jest to plik rdzenia WordPressa, ponieważ zazwyczaj zarządza nim dostawca hostingu.

Możesz sprawdzić jego kod, aby zobaczyć twój limit wykorzystania pamięci PHP. Więcej szczegółów można znaleźć w naszym przewodniku na temat znajdowania i edytowania pliku php.ini.

Ponieważ jednak jest to zaawansowana metoda, zalecamy skontaktowanie się z zespołem pomocy technicznej dostawcy hostingu, aby sprawdzić, czy może on ręcznie zwiększyć limit pamięci WordPress. W przeciwnym razie może to spowodować dalsze błędy.

Możesz przeczytać nasz przewodnik na temat tego, jak prawidłowo poprosić o pomoc techniczną WordPress, aby uzyskać więcej informacji.

Masz dość radzenia sobie z błędami WordPress? W takim razie możesz zostawić stres za sobą i pozwolić naszemu zespołowi ekspertów zapewnić szybkie i niezawodne wsparcie w nagłych wypadkach. Dzięki naszej usłudze na żądanie otrzymujesz szybkie poprawki bez kłopotów związanych z bieżącymi umowami. Zadzwoń do naszego zespołu awaryjnej obsługi WordPress już teraz!

Opcja 4: Aktualizacja twojego hostingu WordPress

Jeśli stale napotykasz błąd wyczerpania pamięci, może to oznaczać, że Twoja witryna przerosła obecny plan hostingowy.

W miarę jak Twoja witryna przyciąga coraz więcej odwiedzających i dodaje więcej treści, wymaga więcej zasobów do płynnego działania. Uaktualnienie planu z wyższym przydziałem pamięci może być trwałym rozwiązaniem.

Rozważ aktualizację twojego hostingu WordPress, jeśli:

  • Wypróbowałeś poprzednie rozwiązania, ale błąd nadal występuje.
  • Twoja witryna internetowa znacznie zwiększyła ruch lub treść.
  • Planujesz dodanie funkcji lub funkcjonalności, które wymagają większej ilości zasobów.

Bluehost oferuje niedrogie i niezawodne plany hostingowe WordPress, które można skalować wraz z potrzebami twojej witryny internetowej. Zapewniają przyjazną dla użytkownika platformę specjalnie zoptymalizowaną pod kątem WordPress, ułatwiając zarządzanie twoją witryną internetową.

Jeśli skorzystasz z naszego kodu kuponu Bluehost, możesz uzyskać do 61% zniżki na twój pierwszy zakup. Wystarczy kliknąć przycisk poniżej, aby go otrzymać:

Bluehost

Jak uniknąć wyczerpania pamięci twojego WordPressa?

Teraz, gdy naprawiono błąd wyczerpania pamięci WordPress, oto kilka proaktywnych kroków, aby zapobiec jego ponownemu wystąpieniu:

Mamy nadzieję, że ten artykuł pomógł ci rozwiązać błąd wyczerpania pamięci WordPress poprzez zwiększenie limitu pamięci PHP. Możesz również zapoznać się z naszym przewodnikiem dla początkujących krok po kroku dotyczącym rozwiązywania problemów z błędami WordPress i naszą ekspercką listą najczęstszych błędów WordPress.

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

463 komentarzeLeave a Reply

  1. This Worked for me.

    /**This is a test for memory*/
    define(‘WP_MEMORY_LIMIT’, ’64M’);

    Thank you for this wonderful share.

  2. Should the memory limit ever be higher than 64M? Most WP sites i’ve worked on the average page load never exceeds 40-5megs. The reason I ask, is I read that the WP_MEMORY_LIMIT defines the amount of memory WordPress can use per Apache thread. Which means that multiple threads will use more and more, and eventually swap to disk which is never good.

    Anybody an expert and can answer this?

  3. It seems like WordPress is either unable to create wp-config.php file or the file gets deleted after the install. Use ftp to make sure that there is a wp-config.php file present on your site. If not then try creating one by renaming the wp-config-sample.php file to wp-config.php file. You will need to manually edit the file and provide your database information.

      • if i locate it on an ftp, and i click on it, it brings it like a download file, pls help with a full guide on how to do it pls my site is going down everyday…

        • don’t double click it. Either right click and select EDIT or highlight it and look for an EDIT button somewhere (maybe at the top if it’s Godaddy). Good Luck!

  4. I opened the wp-config.php file from my ftp directory.
    I was not sure how to completely enter the adjustment – I didn’t know basic coding for php, so I just copied the basic precursors shown for each entry and added as follows:

    /**This is a test for memory*/
    define(‘WP_MEMORY_LIMIT’, ’64M’);

    It worked!

  5. Thank you!!! This fixed a problem I created myself and saved having to pay someone at the hosting company to update the file.

  6. I am getting this exact error but I am not sure how to get into do I get into wp-config.php which is located in the root WordPress directory as I don’t know where to find it. Yes I am a complete beginner. Can you help?

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /home/crooked1/public_html/wp-includes/SimplePie/Sanitize.php on line 331

  7. Thank you so much!! For real.. you have been a lifesaver. I can’t tell you how appreciative I am for your help.

  8. Hi,

    I’ve tried to increase the limit to 64mb, and I got this warning until 5 times:

    ‘WARNING: Job restart due to inactivity for more than 5 minutes.’

    The database backup is stopped until 60s%, and the result is below when it tried to upload to Dropbox:

    ‘ERROR: Uploaded file size and local file size don’t match.’

    What’s wrong with it? I’m using Bluehost.

    Thanks!

    PS: I’m not a technical person, so give explanation in details :-)

  9. Been having a doozy of a time working on my site and I would sacrifice a MacBook at midnight to get my site working, one little line of code and we are back up. Thanks!

  10. Thank you so much!!!!
    I’m in the middle of a launch and all of a sudden I couldn’t update or create any web pages on the whole site because of a 500 Internal Server Error. (And of course this happened as soon as I discovered the Home page had a big problem.)

    Could get no help from support, am not a web developer.

    Yet I was STILL able to follow your instructions and Hallelujah! Miracle of Miracles! Everything works now.

    All this work driving traffic, getting new people to the site – almost wasted due to server error – but Disaster Averted! you saved the day.

    My sincerest gratitude.

    Again, can’t thank you enough.

  11. Thanks so much! I was about to bitch to WooThemes that their $129 extension was breaking my site, but it turned out to be a memory issue. Cheers!

  12. On line 36/37 of wordpress, wp-config.php you must type:

    /** Memory Limit */
    define(‘WP_MEMORY_LIMIT’, ’64M’);

    For me this problem is solve thi way. You can change 64M with what value you want.

    • This comment is sooo key!

      You have to add define( ‘WP_MEMORY_LIMIT’, ’64M’ ); just before the unique key and salts are defined, otherwise the change doesn’t take effect. Thanks!!!

      • yesssss thanks, I was wondering why it didn’t work for me. It was because so far no one told me WHERE in the wp-config i had to add this line. THANKS!!!

  13. Hello,
    Today I had a problem with wordpress: after I logged appeared “white screen of death”. We went into cpanel and inserted “define (‘WP_MEMORY_LIMIT’, ’64M ‘)’ in wp-config.php and everything went very well.
    Thanks a lot WPBeginner.

  14. Thanks a lot, i work very hard with every method i found on internet, but i filled , my problem occur during word-press installation i pasted this code in mid and increase its value to 128 mb , now its works fine, thanks a lot again.

  15. My host provides 64MB, and wants a hefty kicker to increase the php memory limit – so I’m inclined to be “green” and reduce my memory use.

    HOW might I determine what plugins or other things to remove to stay under 64MB
    A) php memory consumption, e.g. which plugins are being greedy
    B) have I got a memory leak issue, e.g. any plugins being nasty

    Thank you for this forum, by the way – I am truly a beginner, but excited about WP (grrr, if I can make it jump its hoops right)

  16. Didn’t work for me, but I’m not sure what it means to be “inside the main php tag”. I opened the file in Dreamweaver and did a search. The word “main” doesn’t appear anywhere on the page. So I put the code in line 2, just after the “<php". Tried it at 64 and 128. Thanks.

  17. Thanks for the help.
    But 64M was already default for me and of course it wasn’t sufficient so I changed it to 96M and I think u should mention this as well.

  18. Nice but nothing works – use rackspace cloud – tried 32 – 64 – 128 – 256- 512 – 1024Mb MU site i can’t go more up and only in admin i can’t get access after a plugin from wpmudev so guess i have to delete that and try something pro.

  19. its really work,, i had problem of internam server,,, when add new plugine,,, i just increse memomry limit
    define(‘WP_MEMORY_LIMIT’, ’64M’);
    in wp-admin and problem solved..

    tthnaks a lot

  20. Thanks a million for this! I got the error message right after the WordPress install–I never even had a chance to add a plug-in.:

    Fatal error: Allowed memory size of 33554432 bytes exhausted…

    All seems to be working fine now.

  21. I have tried to do this, but it has not solved the problem.  I am on 1&1 hosting and I have tried all the changes, but I still get this error whenever uploading a semi-large picture:
     
    Fatal error: Out of memory (allocated 29884416) (tried to allocate 4096 bytes) in /homepages/21/d258522816/htdocs/TBJFilms/WP/wp-includes/media.php on line 1010
     
    What is your suggestion?

  22. Tried placing this at the end of the wp-config.php and didnt work.

    However, placing it on top right after the <?php tag worked. Hooray!

    • Yes, I used the
      1error_reporting(E_ALL); ini_set(‘display_errors’, 1);
      2
      3define( ‘WP_DEBUG’, true);I found in a post next to this one and was getting an error by using define(‘WP_MEMORY_LIMIT’, ‘128M’); on the last line of my php-config file. Thanks to this comment I placed it right below <?php tag at the top and now the error report is no longer :) I just hope my site doesn't keep crashing on every new plugin install, going to check that now. Thanks to all you geeks out there!

  23. this was a great help, but as you noted it could easily be a plugin, or as someone mentioned it could be a memory leak.

    And as others have pointed out, there are memory settings for a reason, some hosts will cut your services if you try to circumvent them.

    Is there a way to check on what’s eating memory?

    I’ll be searching, but this is something that should be listed under related posts, or as a note and link at the end regarding one of the “numerous solutions for it”. Going for the “simplest one” might get you through the day, but is may not be a good long term solution as it may cover up the real problem and delay the inevitable.

    • Worked for me!! I changed my site language to Spanish and I guess that used up the memory. Added the simple line recommended in the post and voilá!! Back in my admin mode. The really helpful part was “Don’t panic!” because my anxiety level was rising fast.
      Thanks ever so much.

  24. @shally1584 There is no = << in our code. So are you sure that you are pasting our code as an independent function and not as part of something else.

  25. hi.i tried to adjust memory limit and got this error

    ‘Parse error: syntax error, unexpected ‘=’ in /home/amanerdm/public_html/beaverealty.com/wp-config.php on line 62′

    pls help fix this.thanx.

  26. Thank you for this post… I had a couple of category / archive query pages that were throwing this error after I upgraded to WordPress 3.1. I was just about to re-write the queries until I found your post in a Google search.

    You saved me a lot of work and headaches :)

  27. I ended up having to switch hosting companies because I couldn’t get my current one to increase the memory from 32MB to, well, anything more. Pretty sad. Took a bit of hassle to transfer three WordPress sites (and multiple other sites), but it was worth it. My current host offers 128MB and my sites are working SO much better. I can actually add plug-ins.

  28. Hello
    I tried the fix by adding the line immediately after the opening >php tag (line 1)
    define(‘WP_MEMORY_LIMIT’, ’64M’);

    It did not work for me BUT
    I placed the line with comments for my own use on (as it happens) line 22 and it worked.

    I am testing this procedure on a test WP site using Twentyten 1.2 Theme

    /home/par*****/public_html/wp-config.php

    Line 22 /** WP memory limit Note it does not work when placed immediately after line 1 */
    define(‘WP_MEMORY_LIMIT’, ’64M’);

  29. This trick doesn’t work for me ever since WP 3.

    what I found worked was to create a PHP.INI file in the wp-admin folder with the line:

    memory_limit = 128M

    (or whatever you want to make it)

  30. I tried this, but my host limits it to 32 megs. Can anyone recommend a good host for WP, because I’m going to have to change. Thanks!

  31. Great article. A brand new plugin that may soon find its way on to this list is Cobalt WP Boost.

    Check it out here:
    http://frugaltheme.com/about/cobalt-wp-boost-plugin/

    It allows blog owners to raise their WordPress Memory Limits with a couple of mouse clicks, as well as showing at-a-glance memory usage information. WordPress keeps its internal memory limit at 32MB, which is fine for a small-time blog; but if you’re trying to add any robust plugins for social networking or ecommerce applications, 32M will not suffice. This problem can only be expected to worsen with the release of 3.0 which, judging from the beta release, will consume a lot more memory itself without upping the 32MB limit.

  32. Just remember that if the problem is a memory leak (either in PHP itself or in some library that is used by a plugin), this will merely delay the occurence.

    Before you change the memory limits, you should ensure that you’re using the most up-to-date versions of any plugins. Be sure you are running the newest version of WP. If your host offers multiple versions of PHP, be sure you’re using version 5.

    Your hosting service may have preset limits on memory usage. If your editing causes you to exceed those limits, your service may be suspended or canceled without warning.

  33. I think that this might fix an issue I’ve been having with my site. I just can’t figure out where the main php table is in the wp-confip.php to place the line.

    Thanks!

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.