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

Correggi: Errore WordPress Memory Exhausted – Aumentare la memoria PHP

L’errore “dimensione della memoria consentita esaurita” in WordPress può essere frustrante. È un problema comune che si presenta quando il vostro sito ha bisogno di più memoria PHP di quella consentita.

Questo errore può rallentare il vostro sito web o addirittura bloccarlo temporaneamente. Per questo motivo è importante correggerlo rapidamente per far sì che il sito funzioni senza problemi per i visitatori.

Fortunatamente, esiste una soluzione semplice a questo problema. Aumentando il limite di memoria di PHP, è possibile risolvere questo errore e migliorare le prestazioni del sito.

In questa guida vi illustreremo i semplici passaggi per aumentare il limite di memoria PHP e rimettere in sesto il vostro sito.

Fix: WordPress Memory Exhausted Error – Increase PHP Memory

Che cos’è l’errore di WordPress Memory Exhausted?

L’errore “WordPress memory exhausted” (memoria esaurita) è un messaggio che potreste vedere se il vostro sito web fatica ad eseguire le attività.

WordPress è costruito utilizzando PHP, un linguaggio di programmazione lato server che ha bisogno di memoria per funzionare.

Proprio come qualsiasi altro computer, i server web hanno una quantità limitata di memoria per eseguire più applicazioni contemporaneamente. I fornitori di hosting WordPress assegnano dimensioni di memoria specifiche a diverse applicazioni, tra cui PHP.

Quando il codice di WordPress necessita di più memoria di quella allocata in modo predefinito, viene visualizzato questo messaggio di errore:

Errore irreversibile: Dimensione di memoria consentita di 33554432 byte esaurita (ha tentato di allocare 2348617 byte) in /home4/xxx/public_html/wp-includes/plugin.php sulla linea xxx

Memory exhausted error displayed on a WordPress site

È possibile che il vostro sito WordPress stia esaurendo la memoria del server:

  • Un gran numero di immagini, video e altri tipi di media
  • Un sacco di plugin WordPress inutilizzati
  • Ha superato le risorse del suo piano di hosting

Di default, WordPress cerca di aumentare automaticamente il limite di memoria di PHP se è inferiore a 64 MB. Tuttavia, spesso 64 MB non sono sufficienti.

Nella prossima sezione, vi mostreremo come aumentare facilmente il limite di memoria PHP in WordPress per evitare l’errore di memoria esaurita. Potete usare i link rapidi qui sotto per navigare nel tutorial:

Nota: alcuni di questi metodi richiedono la modifica diretta dei file di WordPress. Suggeriamo di eseguire prima un backup del sito web per evitare che appaiano ulteriori errori sul sito.

Pronti? Facciamo un salto nel buio!

Opzione 1: Modifica del file wp-config.php

Per prima cosa, è necessario modificare il file wp-config.php sul vostro sito WordPress. Si tratta di uno dei file fondamentali di WordPress, situato nella directory principale, solitamente denominata public_html.

È necessario utilizzare un client FTP come FileZilla o il file manager del pannello di controllo del web hosting.

Quindi, è necessario incollare la seguente riga nel file wp-config.php, subito prima di quella che dice: Questo è tutto, smettete di modificare! Buon blog.

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

Questo codice indica a WordPress di aumentare il limite di memoria di PHP a 256 MB.

Per maggiori dettagli, potete consultare la nostra guida passo-passo su come trovare e modificare il file wp-config.php.

Una volta terminato, è necessario salvare le modifiche e caricare il file wp-config.php sul server.

Ora potete visitare il vostro sito WordPress e l’errore di memoria esaurita dovrebbe essere scomparso.

Opzione 2: modifica del file .htaccess

Il metodo successivo consiste nel modificare il file .htaccess. Anche questo file si trova nella cartella principale del sito web di WordPress.

È necessario incollare il seguente codice prima della riga che dice #END WORDPRESS.

php_value memory_limit 256M

Simile al codice precedente, indica a WordPress di aumentare il limite di memoria di PHP a 256 MB.

Dopodiché, è sufficiente salvare le modifiche e caricare nuovamente il file sul server web. Ora è possibile riaprire il sito web di WordPress per vedere se l’errore relativo al limite di memoria è stato eliminato.

Se non riuscite a trovare il file .htaccess, potete verificare la nostra guida sui motivi per cui il file .htaccess potrebbe mancare e su come trovarlo.

Opzione 3: selezionare il file php.ini

Se i metodi sopra descritti non funzionano, si consiglia di controllare il file php.ini.

php.ini è un file che controlla le impostazioni di PHP, tra cui la versione di PHP e gli script PHP. Non si tratta di un file centrale di WordPress, poiché di solito è gestito dal vostro fornitore di hosting.

È possibile selezionare il codice per vedere il limite di utilizzo della memoria PHP. Per maggiori dettagli, si può consultare la nostra guida su come trovare e modificare il file php.ini.

Tuttavia, poiché si tratta di un metodo avanzato, vi consigliamo di contattare il team di assistenza del vostro fornitore di hosting per verificare se è possibile aumentare manualmente il limite di memoria di WordPress. In caso contrario, si potrebbero verificare ulteriori errori.

Per maggiori informazioni, potete leggere la nostra guida su come richiedere correttamente il supporto di WordPress.

Siete stanchi di avere a che fare con gli errori di WordPress? Lasciatevi alle spalle lo stress e lasciate che il nostro team di esperti fornisca un’assistenza d’emergenza rapida e affidabile. Con il nostro servizio on-demand, otterrete soluzioni rapide senza il fastidio di contratti continui. Chiamate subito il nostro team di assistenza WordPress di emergenza!

Opzione 4: Aggiornamento dell’hosting WordPress

Se si verifica costantemente l’errore di memoria esaurita, potrebbe essere un segno che il vostro sito web ha superato il suo attuale piano di hosting.

Quando il vostro sito web attira più visitatori e aggiunge più contenuti, richiede più risorse per funzionare senza problemi. L’aggiornamento di un piano con una maggiore allocazione di memoria può essere una soluzione permanente.

Considerate di aggiornare il vostro hosting WordPress se:

  • Avete provato le soluzioni precedenti, ma l’errore persiste.
  • Il vostro sito web è cresciuto significativamente in termini di traffico o di contenuti.
  • Si prevede di aggiungere caratteristiche o funzionalità che richiedono maggiori risorse.

Bluehost ospita piani di hosting WordPress affidabili e convenienti, in grado di adattarsi alle esigenze del vostro sito web. Fornisce una piattaforma di facile utilizzo, ottimizzata specificamente per WordPress, che rende facile la gestione del sito web.

Se si utilizza il nostro codice coupon Bluehost, è possibile ottenere fino al 61% di sconto sul primo acquisto. Fai clic sul pulsante qui sotto per ottenerlo:

Bluehost

Come evitare di esaurire la memoria di WordPress

Ora che avete corretto l’errore di esaurimento della memoria di WordPress, ecco alcuni passaggi proattivi per evitare che si ripeta:

Speriamo che questo articolo vi abbia aiutato a risolvere l’errore di esaurimento della memoria di WordPress aumentando il limite di memoria di PHP. Vi consigliamo di consultare anche la nostra guida per principianti, passo dopo passo, alla risoluzione degli errori di WordPress e il nostro elenco di esperti degli errori di WordPress più comuni.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e 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 commentiLeave a Reply

  1. Thanks for this article, we’ve been having this problem too.

    Which setting takes priority?
    In WHM (MultiPHP INI Editor), memory_limit is set to 32M.
    In wp-config.php WP_MEMORY_LIMIT is set to 96M.

  2. but what exactly is this wordpress memory limit, like how much amount of RAM should wp use on the server? can anyone please share about what this thing is?

    thanks

    • The memory limit tells WordPress how large requests/files can be for individual tasks, this is not for your site’s RAM and your RAM usage would be determined by what is on your site.

      Admin

  3. Thanks for the post. It really worked out for me for my problem which was a big head ache for last 5days. Thanks a lot.

  4. There needs to be a way to figure out these memory issues without taking the entire site offline or risking breaking the configuration by disabling essential components. Furthermore, the errors are occurring even when the memory limit is set to the maximum physical memory on the server (32GB) and while they are occurring there is no actual spike in memory usage (system utilities are reporting no increase in actual physical memory use.

  5. Useless when the issue does not depend on actual required memory – in my case it keeps giving the error for random plugins no matter how much memory I specify (up to 32GB). Would be nice to know an actual troubleshooting method to see what is using the memory.

  6. It works, thank you <3

    The error was:
    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 491520 bytes) in…

  7. Thank you so, so, so, sooooooooooo, so much! I guess as I add more posts to the database it requires more memory to operate. Various things were breaking with this internal error over the course of a couple of years, but since I could still make new posts I just said to myself, “meh, carry on.”

    Then I could no longer post! Panic! Everybody PANIC!!!

    I enabled debug mode. I got my debug report. I saw the memory exhausted reported. Then I found this page and gave it a try, thinking, “This probably won’t work. I’ve made too many changes to the theme and some of the plugins to work the way I want. Something somewhere got MuNgEd.

    Nope. Not at all. This one line of code solved it and got be back up and RUNNING!!!! Yay for me!!!! YAY FOR YOU!!!!

  8. And if you have same problem in admin page you can also try

    define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );

    Administration tasks require much memory than usual operation. When in the administration area, the memory can be increased or decreased from the WP_MEMORY_LIMIT by defining WP_MAX_MEMORY_LIMIT.

    WP_MAX_MEMORY_LIMIT sets the maximum just on admin pages. It’s a terrible naming scheme but it dates back to WordPress 2.5 and nobody dares change it now

  9. I have tried this, and now my entire admin panel and website are down, all blocked by that 500 error…. I cannot access anything anymore, and therefore can’t use the File Manager again to remove the change. I’m completely lost, any chance you can help me?

    • Hi Laura,

      If you have access to cPanel dashboard then you can undo the changes from the file manager section there. Alternately, you can contact your hosting provider to help you fix this.

      Admin

  10. i have to use wpml plugin issue is english language text editor working properly but when i text german or spanish language (secndery languages ) text editor cant showing on secndery languages text editor so ghow to fix that problem

  11. Thank you very much
    My issues got solved completely based on your detailed information and help.
    many many thanks
    Majid

  12. I’m not as good at this stuff as I need to be, so I’m still struggling with this.

    I open the config.php file and there is a part that says:
    define( ‘WP_MEMORY_LIMIT’, ‘256M’ );

    only it already says:
    define(‘WP_MEMORY_LIMIT’, ‘1024M’);

    I’ve changed that to 2048 and 4096 with no change.

    But there is no ‘That’s all, stop editing! Happy blogging.’

    after the
    define(‘WP_MEMORY_LIMIT’, ‘1024M’);
    it says
    define(‘WP_DEBUG’, false);

    then
    # That’s It. Pencils down

    It does say ‘That’s all, stop editing! Happy blogging.’ in the Sample config.php but not in the actual one.

    Any advice?

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.