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

Viene visualizzato un messaggio di errore di esaurimento della memoria consentita in WordPress?

Questo è uno degli errori più comuni di WordPress e si può correggere facilmente aumentando il limite di memoria PHP in WordPress.

In questo articolo vi mostreremo come correggere l’errore di esaurimento della memoria di WordPress aumentando il limite di memoria di PHP.

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: Memoria consentita di 33554432 byte esaurita (ha tentato di allocare 2348617 byte) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

Memory exhausted error displayed on a WordPress site

È possibile che il 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.

Detto questo, vediamo come aumentare facilmente il limite di memoria di PHP in WordPress per evitare l’errore di memoria esaurita.

È possibile utilizzare i collegamenti rapidi riportati di seguito per navigare nell’esercitazione:

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.

Opzione 1: Modifica del file wp-config.php

Per prima cosa, è necessario modificare il file wp-config.php sul sito WordPress. Si tratta di uno dei file principali 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, consultate 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, indicherà a WordPress di aumentare il limite di memoria di PHP a 256MB.p

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, selezionate 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 può 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 è un file del nucleo di WordPress, perché di solito è gestito dal 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.

Opzione 4: Aggiornamento dell’hosting WordPress

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

Man mano che il sito web attira più visitatori e aggiunge più contenuti, sono necessarie più risorse per funzionare senza problemi. L’aggiornamento a 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 offer for WPBeginner readers

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. Potreste anche voler consultare la nostra guida passo-passo per principianti alla risoluzione degli errori di WordPress e le nostre scelte di esperti sui migliori plugin di WordPress per far crescere il vostro sito.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

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.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

464 commentiLascia una risposta

  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. Adam says

    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.

  3. arjun says

    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

    • WPBeginner Support says

      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

  4. Ananth Gurunathan says

    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.

  5. Peter says

    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.

  6. Peter says

    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.

  7. Wim Hoogenraad says

    I wish I known that earlier. Now | lost a lot of traffic for my site.
    Hopefully it is fixed now!

  8. Mara says

    It works, thank you <3

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

  9. EAT (my actual initials) says

    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!!!!

  10. Mykola says

    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

  11. Laura Mailleux says

    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?

    • WPBeginner Support says

      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

  12. prashant says

    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

  13. Jonathan says

    Help! i have this problem :(

    Allowed memory size of 268435456 bytes exhausted (tried to allocate 10489856 bytes)

  14. Majid Korm says

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

  15. Jonny says

    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?

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.