4 formas de aumentar o limite de memória do PHP no WordPress

Se você foi surpreendido pela mensagem, “Fatal Error: Allowed memory size 33554432 bytes exhausted (tried to allocate 2975669 bytes) in […]“, quando tentava instalar um plugin, atualizar seu WordPress para a versão mais recente ou tentar efetuar qualquer tipo de ação que consuma muita memória do servidor, fique tranquilo porque existe um jeito de contornar esse problema.

O que precisamos fazer é aumentar o limite de memória do PHP (Memory Limit).

Abaixo vou listar 4 formas de se fazer isso. Faça seus testes e veja qual delas resolve o seu problema.

1) Aumentando o limite de memória via arquivo php.ini

Você pode facilmente aumentar o limite de memória do PHP através do arquivo php.ini. Muitos hosts pequenos não fornecerão acesso a esse tipo de arquivo, mas alguns sim. Então, se seu host te permite criar um arquivo php.ini na sua área de hospedagem, essa forma poderá ajudá-lo.

Para fazer isso crie um arquivo php.ini — caso ele não exista — e coloque-o dentro do diretório em que seu WordPress está instalado.

Dentro desse arquivo coloque o seguinte comando:

Isso fará com que a diretiva memory_limit padrão do servidor seja alterada para 64 Mb. Salve e teste!

Obs.: Em alguns casos é interessante colocar uma cópia do arquivo php.ini dentro da pasta wp-admin também! #ficadica

2) Alterando o limite de memória via wp-config.php

Se você não tem acesso ou não pode criar um arquivo php.ini na sua área de hospedagem, talvez você consiga o mesmo resultado através do arquivo wp-config.php.

Abra o arquivo wp-config.php e coloque o seguinte comando:

3) Modificando o arquivo .htaccess para aumentar o limite de memória do PHP

A instalação padrão do WordPress não tem um arquivo .htaccess. Mas caso você já tenha criado um, abra-o e coloque o seguinte comando antes de qualquer outro comando existente:

4) Conversando com seu Host

O artigo ajudou ?
SimNão

35 Comments

ìåéä złożoną pytanie dostępną Dużą pracę|To wyślij to klejnot Więc zadowolony jak poncz znalazłem to|Ty zmusić, aby niesamowite zdolność do pisania otwarta treść|To pismo na najwyższym poziomie zdobyłeś modern obserwującego|Twój kolekcja był zarówno wnikliwy, jak i pięknie napisany|Jestem zdumiony by jak wiele nauczyłem się z tego posta|wykonujesz ogromną pracę To post jest zeznanie o tym} {https://kredytero.pl|kredytero.pl|kredyt|kredyty|kredyt online|kredyty online|kredyt przez internet|kredyty przez internet}!

Jestem pod wrażeniem Twojej przenikliwości wiedzy i ekspozycja umiejętność złożoną teza dostępną Świetną pracę|To zarejestruj się to klejnot Więc zadowolony zacząłem to|Ty był uderzony zdumiewające zdolność wydziału do pisania angażująca treść|To pismo na najwyższym poziomie zdobyłeś modern obserwującego|Twój enter był zarówno wnikliwy, jak i uroczo napisany|Jestem zdumiony podczas jak wiele kulturalnie z tego posta|wykonujesz ogromną pracę To wysłanie jest ratyfikacją o tym} {pożyczki online|pożyczki|pożyczki pozabankowe|http://pozyczkaland.pl/|pozyczkaland.pl/|pożyczka online|pożyczka|pożyczka pozabankowa}!

Your latest blog post truly resonated with me! The depth of insight and the clarity of your thoughts are commendable. It’s evident that you’ve put a lot of thought and research into this topic, and it shows. Your ability to present complex ideas in such an accessible and engaging manner is a rare skill. Thank you for sharing your knowledge and perspective – it’s been a thought-provoking read and I’m already looking forward to your next piece!

Good post. I be taught one thing tougher on different blogs everyday. It should at all times be stimulating to learn content from different writers and observe a bit of something from their store. I’d favor to make use of some with the content material on my weblog whether or not you don’t mind. Natually I’ll give you a hyperlink in your internet blog. Thanks for sharing.

Hello, I think your website might be having browser compatibility issues. When I look at your blog site in Chrome, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, superb blog!

Hello there! This is my 1st comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading through your blog posts. Can you recommend any other blogs/websites/forums that deal with the same topics? Thanks a ton!

Hey! I understand this is kind of off-topic but I had to ask. Does operating a well-established website like yours require a massive amount work? I am completely new to running a blog however I do write in my journal on a daily basis. I’d like to start a blog so I can easily share my own experience and views online. Please let me know if you have any kind of ideas or tips for new aspiring bloggers. Thankyou!

Deixe uma resposta