¿Ves un mensaje de error de tamaño de memoria permitido agotado en WordPress?
Este es uno de los errores más comunes de WordPress, y puedes corregirlo fácilmente aumentando el límite de memoria PHP en WordPress.
En este artículo, le mostraremos cómo corregir el error de memoria agotada de WordPress aumentando el límite de memoria PHP.
¿Qué es el error de memoria agotada de WordPress?
El error de memoria agotada de WordPress es un mensaje que puede aparecer si su sitio web tiene problemas para realizar tareas.
WordPress utiliza PHP, un lenguaje de programación del lado del servidor que necesita memoria para funcionar.
Al igual que cualquier otro ordenador, los servidores web disponen de una cantidad limitada de memoria para ejecutar varias aplicaciones al mismo tiempo. Los proveedores de alojamiento de WordPress asignan tamaños de memoria específicos a diferentes aplicaciones, incluido PHP.
Cuando su código WordPress requiera más memoria que la asignada por defecto, verá este mensaje de error:
Error fatal: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
Es posible que su sitio WordPress esté agotando la memoria de su servidor:
- Muchas imágenes, vídeos y otros tipos de medios
- Muchos plugins de WordPress sin usar
- Se le han quedado pequeños los recursos de su plan de alojamiento
Por defecto, WordPress intenta automáticamente aumentar el límite de memoria PHP si es inferior a 64MB. Sin embargo, 64MB no suele ser suficiente.
Dicho esto, veamos cómo aumentar fácilmente el límite de memoria PHP en WordPress para evitar el error de memoria agotada.
Puedes utilizar los enlaces rápidos que aparecen a continuación para navegar por el tutorial:
Nota: Algunos de estos métodos requieren que edite directamente sus archivos de WordPress. Le sugerimos que primero haga una copia de seguridad de su sitio web para evitar que aparezcan más errores en su sitio web.
Opción 1: Editar el archivo wp-config.php
En primer lugar, debe editar el archivo wp-config.php en su sitio de WordPress. Se trata de uno de los archivos principales de WordPress situado en el directorio raíz, normalmente denominado public_html.
Tendrás que utilizar un cliente FTP como FileZilla o el gestor de archivos de tu panel de control de alojamiento web.
A continuación, tienes que pegar la siguiente línea en el archivo wp-config.php justo antes de la que dice, ¡Eso es todo, deja de editar! Feliz blog.
define( 'WP_MEMORY_LIMIT', '256M' );
Este código le dice a WordPress que aumente el límite de memoria PHP a 256MB.
Para más detalles, consulte nuestra guía paso a paso sobre cómo encontrar y editar el archivo wp-config.php.
Una vez que haya terminado, debe guardar los cambios y volver a subir el archivo wp-config.php a su servidor.
Ahora puede visitar su sitio WordPress y el error de memoria agotada debería haber desaparecido.
Opción 2: Editar el archivo .htaccess
El siguiente método consiste en editar el archivo .htaccess. Este archivo también se encuentra en la carpeta raíz del sitio web de WordPress.
Aquí, necesitas pegar el siguiente código antes de la línea que dice #END WORDPRESS
.
php_value memory_limit 256M
Similar al código anterior, le dirá a WordPress que aumente el límite de memoria PHP a 256MB.p
Después, simplemente guarde los cambios y vuelva a subir el archivo a su servidor web. Ahora puede abrir su sitio web WordPress de nuevo para ver si el error de límite de memoria ha desaparecido.
Si no encuentra el archivo .htaccess, consulte nuestra guía sobre por qué puede faltar el archivo .htaccess y cómo encontrarlo.
Opción 3: Comprobación del archivo php.ini
Si los métodos anteriores no funcionan, es posible que desee echar un vistazo a su archivo php.ini.
php.ini es un archivo que controla tu configuración PHP, incluyendo la versión PHP y los scripts PHP. No es un archivo del núcleo de WordPress, ya que normalmente lo gestiona tu proveedor de alojamiento.
Puede marcar / comprobar su código para ver su límite de uso de memoria PHP. Para más detalles, puede consultar nuestra guía sobre cómo encontrar y editar el archivo php.ini.
Sin embargo, dado que se trata de un método avanzado, le recomendamos que se ponga en contacto con el equipo de soporte de su proveedor de alojamiento web para ver si pueden aumentar el límite de memoria de WordPress manualmente. De lo contrario, podrían producirse más errores.
Puede leer nuestra guía sobre cómo solicitar correctamente asistencia de WordPress para obtener más información.
Opción 4: Actualizar el alojamiento de WordPress
Si se encuentra constantemente con el error de memoria agotada, podría ser una señal de que su sitio web ha superado su plan de alojamiento actual.
A medida que su sitio web atrae más visitantes y añade más contenido, requiere más recursos para funcionar sin problemas. Actualizar a un plan con una mayor asignación de memoria puede ser una solución permanente.
Considere la posibilidad de actualizar su alojamiento de WordPress si:
- Has probado las soluciones anteriores y el error persiste.
- Su sitio web ha crecido significativamente en tráfico o contenido.
- Tiene previsto añadir características o funcionalidades que requieren más recursos.
Bluehost ofrece planes de alojamiento para WordPress asequibles y fiables que se adaptan a las necesidades de su sitio web. Ofrecen una plataforma fácil de usar optimizada específicamente para WordPress, lo que facilita la gestión de tu sitio web.
Si utiliza nuestro Bluehost código de cupón, entonces usted puede conseguir hasta un 61% de descuento en su primera compra. Simplemente haga clic en el botón de abajo para conseguirlo:
Cómo evitar agotar la memoria de WordPress
Ahora que ha solucionado el error de memoria agotada de WordPress, aquí tiene algunos pasos proactivos para evitar que vuelva a ocurrir:
- Desactive los plugins que no utilice. Muchos plugins contribuyen al consumo de memoria. Revisa regularmente los plugins que tienes instalados y desactiva los que no utilices para liberar memoria para tareas esenciales.
- Optimiza las imágenes. Las imágenes grandes pueden consumir mucha memoria. Considera usar un plugin como EWWW Image Optimizer para comprimir automáticamente las imágenes antes de subirlas a tu sitio.
- Utiliza un plugin de caché. Los plugins de caché almacenan los datos del sitio web, reduciendo la necesidad de que WordPress los regenere en cada visita. Esto puede mejorar significativamente el rendimiento del sitio web y reducir el uso de memoria.
Esperamos que este artículo te haya ayudado a solucionar el error de memoria agotada de WordPress aumentando el límite de memoria PHP. Puede que también quieras ver nuestra guía paso a paso para principiantes sobre cómo solucionar errores de WordPress y nuestras selecciones de expertos sobre los mejores plugins de WordPress para hacer crecer tu sitio.
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.
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!
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
Bijay Budhathoki
It Worked for me when i changed the following
define(‘WP_MEMORY_LIMIT’, ‘264M’);
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.
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
ussy
worked for me
Thanks
I increased it to 512M
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
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
WPBeginner Support
Try switching to a default theme and see what happens.
Administrador
Pascal mutulu
Thanks,
define(‘WP_MEMORY_LIMIT’, ’64M’);
It worked for me in a second after 1week hustle.
Tuấn
thank you so much, you are save my life, it’s worked like a charm!!
Avtar Nanrey
You’re a life saver. Thank You.
Olagoke Tobi
Thanks guys, worked like a charm!!!!!
Naveen Rishi
Nice buddy, Thanks
RetroMike
Nice one! Instafix
(well… after opening loads of other tabs and not doing it for 10 minutes…)
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
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. */”
Administrador
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 ?
WPBeginner Support
First try updating your permalinks. Simply visit Settings » Permalinks and then click on the save changes button without changing anything. If that doesn’t solve it, then it could be a file permission issue. See our guide on how to fix common image issues in WordPress.
Administrador
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
Jhasketan Garud
Thanks a lot . It just saved me from a 503 error as well.
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
WPBeginner Support
See how to increase memory size in WordPress. If this does not solve your problem, then try using another related posts plugin.
Administrador
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
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
Mos
Hello,
How do identify the main php tag?
Thanks!
Christian
Sweet! Worked perfectly. Thanks!
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.
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
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
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
Lindsay
Worked like a charm! Thanks for the super simple fix!
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!
David
Please how do I locate my Root WordPress Directory. Please explain with images to help me understand better. Thanks
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
WPBeginner Support
May be this article will help: How to fix the WordPress white screen of death.
Administrador
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.
Kenold Beauplan
128M worked for me.
Thanks
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
Sabir Hussain
so simple
check this file
public_html/wp-includes/default-constants.php
Enjoy
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)
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!!!!
Alinn
Thanks a lot
herman
I can’t even get into the admin dashboard. I can’t login to do the changes.
WPBeginner Support
Please see our guide on what to do when you are locked out of WordPress admin area.
Administrador
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
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!
Kassiah
Thanks for this great tip! Worked like a charm
Saskia
I have a white screen and cannot open the items in the wordpress directory (only SEO and guestbook). How to increase the memory?
Alex
Hi guys,
This method can be use to fix the “508 Resource Limited Reached” Problem?
Thank You
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.
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!
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.
Anriëtte
Had a strong suspicion this won’t work for my host, but it did, thanks!
Noel Cammack
Thanks for the help WPBeginner! You guys rock!
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’);
tegori.org
brilliant! thanks for this. I had to increase the limit to 256M, but it worked like a charm.
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.