Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Puchar WPB
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

Uwaga redakcyjna: Otrzymujemy prowizję z linków partnerskich na WPBeginner. Prowizje nie mają wpływu na opinie i oceny naszych redaktorów. Dowiedz się więcej o Proces redakcyjny.

Czy widzisz komunikat o błędzie wyczerpania dozwolonego rozmiaru pamięci w WordPress?

Jest to jeden z najczęstszych błędów WordPress i można go łatwo poprawić, zwiększając limit pamięci PHP w WordPress.

W tym artykule pokażemy, jak poprawić błąd wyczerpania pamięci WordPress poprzez zwiększenie limitu pamięci PHP.

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: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line 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.

Powiedziawszy to, zobaczmy, jak łatwo zwiększyć limit pamięci PHP w WordPress, aby uniknąć błędu wyczerpania pamięci.

Możesz skorzystać z poniższych odnośnikó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.

Opcja 1: Edycja pliku wp-config.php

Po pierwsze, musisz edytować plik wp-config.php na twojej 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.

Aby uzyskać więcej informacji, zobacz nasz przewodnik krok po kroku, jak znaleźć i edytować plik wp-config.php.

Gdy skończysz, musisz zapisać zmiany i przesłać plik wp-config.php z powrotem na twój 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.p

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 .htaccess, zapoznaj się z naszym przewodnikiem na temat tego, dlaczego może go bra kować i jak go znaleźć.

Opcja 3: Sprawdzenie twojego pliku php.ini

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

php.ini to plik, który kontroluje twoje ustawienia PHP, w tym wersję PHP i skrypty PHP. Nie jest to plik rdzenia WordPressa, ponieważ zazwyczaj zarządza nim twój 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.

Opcja 4: Aktualizacja twojego hostingu WordPress

Jeśli ciągle napotykasz błąd wyczerpanej pamięci, może to oznaczać, że twoja witryna internetowa przerosła obecny, aktualny plan hostingowy.

Gdy twoja witryna internetowa przyciąga więcej odwiedzających i dodaje więcej treści, wymaga więcej zasób do sprawnego funkcjonowania. Uaktualnienie do 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 offer for WPBeginner readers

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. Zachęcamy również do zapoznania się z naszym przewodnikiem dla początkujących krok po kroku dotyczącym rozwiązywania problemów z błędami WordPress a oraz naszymi eksperckimi propozycjami najlepszych wtyczek do WordPressa, które pomogą rozwinąć twoją witrynę.

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.

Ujawnienie: Nasze treści są wspierane przez czytelników. Oznacza to, że jeśli klikniesz na niektóre z naszych linków, możemy otrzymać prowizję. Zobacz jak WPBeginner jest finansowany, dlaczego to ma znaczenie i jak możesz nas wspierać. Oto nasz proces redakcyjny.

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.

Najlepszy zestaw narzędzi WordPress

Uzyskaj BEZPŁATNY dostęp do naszego zestawu narzędzi - zbiór produktów i zasobów związanych z WordPressem, które każdy profesjonalista powinien mieć!

Reader Interactions

464 komentarzeZostaw odpowiedź

  1. Syed Balkhi says

    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. mohadese esmaeeli says

    With your permission, I’d like to add a note for users to the article:
    Please note that htaccess is a hidden file. First, check if it exists. In case you couldn’t find the .htaccess file in your hosting, you can create one using text editor programs like Notepad. Simply create a file named htaccess. Alternatively, in the public_html directory, click on „New File” and create a file with the same name.

  3. mohadese esmaeeli says

    I have encountered this issue multiple times, and it seems to be one of the most common problems in the WordPress domain. Each time, I either contacted the hosting support or edited the htaccess file to resolve the issue. The htaccess file appears to be like a magic solution, and whenever an issue arises, it can be quickly reviewed and fixed.

  4. Mrteesurez says

    I used to encounter some errors like this on my websites but I didn’t know what to do. Something when I tried to solve it, I just uninstall the step and re-install it back and upload the backup.
    I noticed the problems still persist, when I enable wp debug mode, t then see the exact errors and the it’s source.
    I later find this guide and implented it and it works.

    Thanks.

  5. karma tsheten says

    AFter updating my .htaccess it gives me this error:

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

  6. Jiří Vaněk says

    Regarding the .htaccess file, be cautious. Many shared web hosting providers may have directives for increasing the memory limit disabled. Such a directive in the .htaccess file can cause a 500 error on the website, requiring its removal or commenting out. Be careful with this. Sometimes, simply increasing the memory limit may not solve the problem but rather delay it, like a painkiller. The pain might subside, but it doesn’t mean the cause has been resolved. Therefore, while increasing the memory limit might seem like a solution, it’s also important to check what is consuming the memory. Sometimes, people increase the memory limit from 512 MB to 1024 MB without considering whether it’s necessary, and whether the memory limit isn’t masking an underlying issue on the website.

    • WPBeginner Support says

      Thank you for sharing your feedback on the htaccess change. Unless the host has very strict rules in place adding to the htaccess shouldn’t cause an error it is more likely to not work and would require you reach out to the host to request an override.

      Administrator

  7. Aisha says

    It doesn’t solve my problem still shows an error after placing the code “define( ‘WP_MEMORY_LIMIT’, ‘256M’ );” and I also change the size of Memory_limit of Php.ini file

    • WPBeginner Support says

      As we state in the article, if our code does not work, there is a good chance your hosting provider is overriding the memory limit and you would need to reach out to your host to fix the error.

      Administrator

  8. Sohaib Siddiq says

    It doesn’t solve my problem still shows an error after placing the code „define( 'WP_MEMORY_LIMIT’, '256M’ );” & this is my front-end page showing

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 8192 bytes) in /home/X/wp-includes/class-wp-dependencies.php on line 260

    • WPBeginner Support says

      If the code does not work for you, we recommend reaching out to your hosting provider as they may have a limit set on their end that could be the root of the issue.

      Administrator

  9. Ifedayo says

    Thank you, this was helpful! All problem has been solved by carefully following this step-by-step instructions. Keep up the good work :)

  10. Doy says

    Hi,

    Thank you for this awesome website. I got this in the error log after adding this code.
    [26-Apr-2022 02:45:31 UTC] PHP Warning: Use of undefined constant ‘WP_MEMORY_LIMIT’ – assumed '‘WP_MEMORY_LIMIT’’ (this will throw an Error in a future version of PHP) in /wp-config.php on line x

    Is this a problem? Should I remove the code?

    • WPBeginner Support says

      That would only be an error for future versions of PHP. This solution should only be a temporary fix and your hosting provider should be able to assist with the root cause of the issue.

      Administrator

  11. Alison Taylor says

    Thank you! You folks rock. This solved my problem. WPBeginner is my go-to website for learning new things about WordPress, even though I’m not a beginner.

  12. J h says

    „Once you are done, you need to save your changes and upload your wp-config.php file back to your server.”

    How again do you upload the file back to your server?

    • WPBeginner Support says

      You would need to use FTP or your host’s file manager again and there should be the option to upload and replace the file :)

      Administrator

  13. Daniel says

    The changes are not having effects. We are still with 40MB and the site does not accept the changes. What should I do?

    • WPBeginner Support says

      As we state at the end of the article, if our recommendations do not work, please reach out to your hosting provider as they may have set a limit that would override what you as a user can set.

      Administrator

  14. Liviu says

    Really worked.

    I had white screen when I wanted to create a new post on PC browser. But worked on my phone.

    Thanks

  15. John Harries says

    Thank you for providing a straight forward solution to an error which occurred when I tried to update the php version from 7.1 to 7.4

  16. Mart says

    Fantastic, thank you soooo much for this, simple straight talk.. excellent.. first problem solved … now got to learn more

    • WPBeginner Support says

      It can mean the site can take longer to notice issues if some arise but shouldn’t cause a major issue in general.

      Administrator

  17. Mujahid Siyal says

    I added the code problem is gone but a text „WP_MEMORY_LIMIT” has appeared in the top corner of logo. So what should I do about that?

    • WPBeginner Support says

      You would want to ensure you added the code snippet correctly as it is likely showing that code thinking it is text.

      Administrator

  18. David says

    „First you need to edit the wp-config.php file on your WordPress site. It is located in your WordPress site’s root folder, and you will need to use an FTP client or file manager in your web hosting control panel.”

    Simple! What does that mean? It is gobbledegook to me.

  19. Katerina says

    I’m new in WordPress and I’m trying to figure out, for a couple of days, why suddenly I get an error 500 and can’t save my edits. This helped solve my problem. Thank you so much!

  20. Arpita Hunka says

    This solution is not working for me, my website is hosted at AWS server and I have all the access, I have tried to set memory_limit in php.ini, wp-config and .htaccess. but still getting issue when accessing backend pages.

    • WPBeginner Support says

      You would want to reach out to the support for your hosting for what other options you have available with AWS

      Administrator

    • WPBeginner Support says

      If our recommendations are not working, you would want to reach out to your hosting provider and they should be able to assist

      Administrator

  21. Ivan says

    Hi, I had the memory exhausted message and I increased the wp memory limit to 12mb and it worked. Then a few days later I had the same error, so I had to increase the wp memory limit to 256mb and the message kept showing. I am currently on 1024mb, which seems excessive for a small website of 4 pages and a blog post of 15,000 words. Any suggestions how to resolve the issue or what might be causing it?

    • WPBeginner Support says

      You would want to reach out to your hosting provider and they can normally assist in finding the root of the issue for your specific site.

      Administrator

Zostaw odpowiedź

Dziękujemy za pozostawienie komentarza. Pamiętaj, że wszystkie komentarze są moderowane zgodnie z naszymi polityka komentarzy, a Twój adres e-mail NIE zostanie opublikowany. NIE używaj słów kluczowych w polu nazwy. Przeprowadźmy osobistą i konstruktywną rozmowę.