If you’re facing the WordPress error “Allowed Memory Size Exhausted”, the fastest solution is to increase the WordPress memory limit by updating your wp-config.php, php.ini, .htaccess file or by requesting a higher limit from your hosting provider.
In most cases, setting the WordPress PHP memory limit to 128MB or 256MB immediately resolves fatal errors, improves stability, and restores normal site performance, especially on hypermedia-heavy websites.
In this article, we’ll guide you on how to increase the WordPress PHP memory limit to correct memory exhaustion error in five methods. So, let’s dive into all these methods one by one after exploring the basics of WordPress memory limit.
Quick Overview
To resolve WordPress “Allowed Memory Size Exhausted” error, the fastest solution is to increase the WordPress memory limit by updating your wp-config.php, php.ini, .htaccess file or by requesting a higher limit from your hosting provider.
Here are the methods of how to increase WordPress memory limit in short:
Method 1: Increase WordPress memory limit via wp-config.php
- Edit the wp-config.php file and increase the value of WP_MEMORY_LIMIT from 64M to 128M or 256M. This is the most reliable and beginner-friendly method.
Method 2: Increase PHP memory limit using php.ini
- If the issue persists, update the PHP memory limit in the php.ini file by setting memory_limit = 256M or higher.
- Restart the server after saving changes.
Method 3: Modify the .htaccess file
- When php.ini access is restricted, add memory limit rules to the .htaccess file to increase PHP memory allocation at the server level.
Method 4: Use a WordPress memory extend plugin
- Install a memory extend plugin such as WPMemory and WP Tools to increase the WordPress memory limit without editing core files. This method is ideal for beginners and non-developers.
Method 5: Contact your hosting provider or upgrade hosting
- If none of the above methods work, your hosting plan may be enforcing strict limits. Request a higher memory allocation or upgrade your hosting plan to unlock better performance and scalability.
What is WordPress memory limit?
WordPress memory limit is the maximum amount of server memory (RAM) that a WordPress site is allowed to use while executing PHP scripts.
Why WordPress memory limit matters for your site performance?
The WordPress memory limit directly impacts how efficiently your site handles PHP processes, plugins, and dynamic content. When the memory allocation is too low, WordPress struggles to execute essential tasks.
Learn more why memory limit matters for your site performance:
- Smooth operation: It ensures WordPress has enough PHP memory to run complex operations without interruption.
- Minimizes errors: It Reduces the risk of critical errors such as “Allowed memory size exhausted”.
- Heavy tool support: It supports heavy plugins and builders that demand more memory.
- Loading time: Memory limit reduces slowdown while high traffic or complex request (e,g. backups, imports).
- Sudden failure: this keeps theme and plugin features fully functional without unexpected failures.
- Consistent site performance: It improves consistency of site performance across different environments.

Hur man ökar PHP-minnesgränsen och maximal uppladdningsgräns i WordPress:

There are five options you can use to resolve WordPress Memory Exhausted Errors and raise the memory capacity and upload limit in WordPress.
Let’s have a look in detail on how to increase the PHP memory limit in WordPress! 😃
Notera: Always keep a new säkerhetskopiering av dina webbplatsfiler och databas innan du gör några betydande ändringar så att du kan återställa din webbplats om du gör ett misstag.
1. Increase WordPress memory limit via wp-config.php
Eftersom det innehåller din grundläggande konfigurationsinformation är wp-config.php-minnet en av de viktigaste filerna för en WordPress-webbplats. Denna WP-konfigurationsminnesbegränsningsfil finns i rotkatalogen i ditt WordPress-filsystem.

- Look for this line to edit the memory and upload limits on the wp-config.php memory limit file. Here is the WordPress minimum memory limit:
define('WP_MEMORY_LIMIT', '64M');
- Förändra the value to a higher limit, such as ‘128M’ or ‘256M’.
- Spara the WP config PHP memory limit file and check if the error is resolved.
- Note that some hosting providers may limit the maximum WordPress memory you can allocate, so you might not be able to set it to an arbitrarily high value.
define('WP_MEMORY_LIMIT', '128M');
Notera: You’re good to go with this WP config.php memory limit increase method. However, If you’re still having a fatal error, you might need to increase it again. But don’t go too far or din server kommer att krascha. Eller så kan du söka hjälp från din värd.
2. Edit your PHP.ini file to increase WP memory limit
If changing the wp-config.php file doesn’t solve the problem, you’ll have to deal with the problem in your server settings. WordPress’s PHP memory limit increase method may work here.
Du kommer inte att kunna komma åt din PHP.ini-fil om du använder delad hosting. Om du har tillgång till PHP.ini. Det är troligen i rotmappen, men filens plats varierar beroende på värden.
Här är vad du behöver göra:
- Locate or find your php.ini file. If you can’t find it, simply build your php.ini file och spara it in the WordPress installation’s root directory.
- Använda sig av your favorite editor to open and redigera your php.ini file.
- Look for the line that says ‘memory limit = 32M’.
- Förändra the 32M or some other number to the desired limit (e.g. 256M or 512M).
- Restart your local host or server after saving your changes.
Notera: Om du har skapat din egen php.ini-fil måste du lägga till följande rad i den:
minnesgräns = 256M (eller 512M)
I vissa fall, när du går ner i listan från rad ett till rad tre, kan värdena du lägger till växa sig större. De "minnesgräns" bör vara störst, medan "ladda upp max filstorlek" bör vara den lägsta. Och den 'post max storlek' bör vara medianen.
Clear your browser’s cookies before checking if the WordPress memory limit error has disappeared.
3. Edit your .htaccess file
If you don’t have access to PHP.ini, you’ll have to take the following attempts:
- Redigera your WordPress .htaccess memory limit file as a last resort. Since it is a secret file, the .htaccess file begins with a mark.
- Kolla upp to see if your SFTP file manager is keeping some files hidden from view if you don’t see them in your root folder.
- Here are the details you need to add to your .htaccess file to increase the WordPress memory limit:
php_value memory_limit 256M php_value upload_max_filesize 12M php_value post_max_size 13M- Increase the WordPress PHP memory capacity if it hasn’t already been set. You can använd följande kod to increase the PHP WordPress memory limit:
ini_set('memory_limit', '512M'); Det fungerar dock bara för filen där det är skrivet.4. Use the memory extend plugin
Other than editing wp-config.php, PHP.ini, and .htaccess files, you can extend the limit by utilizing the WordPress PHP memory limit increase plugin. There are numerous memory extend plugins such as WPMinne, WP-verktyg, etc. Dessa WordPress-plugins för minnesbegränsning let you improve limits without touching your memory limit files. It is a friendly process for beginners and non-coders. So, try to optimize the memory limit by adopting a memory extend plugin if you want to avoid coding hassle.
5. Through the hosting provider
Contacting your hosting provider to increase your memory limit is the easiest among all methods. Most of the popular hosting providers include this service. However, their services may vary depending on the type of package you’re using. Also, some might not include this option. In this case, you need to adopt any one of the four methods mentioned above to enhance the memory capacity of your WordPress site.
6. Upgrade hosting service:
Upgrading your hosting plan becomes essential when your WordPress site starts demanding more server resources than your current hosting environment can provide. A higher-tier hosting plan offers increased PHP memory limits, better resource allocation, and improved scalability which ensures your site runs smoothly without constant technical interupption.
You should upgrade your hosting plan when:
- You frequently encounter memory exhausted or fatal errors despite increasing the WordPress memory limit.
- Your site has outgrown shared hosting limitations.
- You are running WooCommerce, page builders, or multiple resource-intensive plugins.
- High traffic causes slow loading times or server timeouts.
- Site operations like backups, imports, or updates fail or take too long.
- You need better performance, reliability, and room for future growth.
How to Fix Memory Limit While Migrating to a Live Server?
As PHP is a server-side programmeringsspråk, and WordPress is written in it. For PHP to work properly, every website needs a hosting server.
So, when you move a local WordPress site to a live server, it’s quite common to run into PHP memory limit errors. This usually happens because your local machine has more flexible resources, while most hosting environments (especially shared hosting) set strict limits to keep things under control.
Here’s a breakdown of why this happens and how to fix it:
1. Increase PHP memory limit in wp-config.php:
- You can increase the WordPress memory limit by adding a line to your
wp-config.phpfil.
define( 'WP_MEMORY_LIMIT', '256M' );- The ‘256M’ (256 mega bites) here is the PHP memory limit. You can replace this to a higher value like ‘512M’ to increase the memory limit.
2. Update php.in file:
If updating your wp-config.php file doesn’t fix the issue, it could be that your server’s global PHP memory limit is set lower. In that case, you will need to:
- Justera php.ini file if you have the edit access to it.
- The location of this file can vary depending on your hosting setup. Find it inside your hosting control panel (like cPanel).
- If you can’t locate it, your hosting provider can point you in the right direction.
- Once you’ve opened the file, search for the following line that says memory_limit and increase the value to a higher limit.
Before:
memory_limit = 256M;Efter:
memory_limit = 512M;3. Edit .htaccess File
Some hosting providers (mostly Apache servers) let you to override PHP settings right from the .htaccess file in your WordPress root folder.
- Add this line to edit .htaccess file:
php_value memory_limit 512MHur mycket minne behöver WordPress?
Minneskraven för WordPress kan variera beroende på flera faktorer som storleken och komplexiteten på din webbplats, antalet plugins och teman du använder och mängden trafik som din webbplats får. Därför är det inte så enkelt att svara på hur mycket minne WordPress behöver.
WordPress i sig har ett minsta minneskrav på 64MB, men detta är vanligtvis inte tillräckligt för de flesta webbplatser. Ett rekommenderat minimum är cirka 128 MB, även om många värdleverantörer rekommenderar att tilldela 256 MB eller mer för optimal prestanda.
Om du har en liten webbplats med grundläggande funktionalitet och låg trafiknivå borde 256MB minne vara tillräckligt. Men när din webbplats växer och du lägger till fler plugins, teman och trafiken ökar, kan du behöva allokera mer minne.
It’s worth noting that memory requirements can also vary depending on the hosting environment. Shared hosting plans may have stricter memory limitations compared to dedicated or cloud hosting solutions, such as Kinsta.
För att bestämma de exakta minneskraven för din WordPress-webbplats kan du övervaka din webbplats minnesanvändning med hjälp av verktyg från din värdleverantör eller WordPress-plugins. Dessa verktyg kan hjälpa dig att identifiera om din webbplats tar slut på minne och om ytterligare resurser behöver allokeras.
Det rekommenderas alltid att du rådgör med din värdleverantör eller systemadministratör för att fastställa den optimala minnesallokeringen för din specifik WordPress-installation, eftersom de kan ge vägledning baserat på din webbplats krav och värdmiljön.
Vad är ett WordPress Memory Exhausted Error?
För mer detaljerad information, kolla in vår video om Lösning för dödlig fel Nedan:
Webbservrar fungerar på samma sätt som alla andra enheter. De behöver minne för att köra flera applikationer effektivt samtidigt. Olika program i WP tilldelas olika mängder minnesgräns av serveradministratörer.
När WordPress körs behöver det en viss mängd minne (RAM) för att hantera olika uppgifter, som att bearbeta teman och plugins och köra PHP-skript. Som standard sätter WordPress en gräns för hur mycket minne det kan använda. Om din webbplats överskrider den här gränsen kommer du att stöta på felet "Memory Exhausted Error".
| Allvarligt fel: WordPress allowed memory size of 67108864 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx Eller Allvarligt fel: Tillåten minnesstorlek på 41943040 byte uttömd fatalt fel tillåten minnesstorlek WordPress |
Det här felmeddelandet visas när din WordPress-kod behöver mer minnesgräns än den standardtilldelade minnesbegränsningen.
Vad är "Tillåten minnesstorlek för bytes slut" i WordPress
Felmeddelandet "Tillåten minnesstorlek för bytes slut" i WordPress indikerar att din WordPress-webbplats har överskridit minnesgränsen som tilldelats den. Varje WordPress-webbplats har en fördefinierad minnesgräns som begränsar mängden minne som PHP kan använda när skript körs.
When a script, such as a plugin or a theme, tries to allocate more memory than the WordPress allowed memory size or limit, this error occurs. The error message usually includes the specific memory size that has been exhausted.
Till exempel kan felmeddelandet se ut så här:
Allvarligt fel: Tillåten minnesstorlek på 67108864 byte förbrukad (försökte allokera 123456 byte) i /path/to/wordpress/wp-includes/some-file.php på rad 123
Vad är WordPress PHP-minnesgränsen?
PHP är programmeringsspråk på serversidan som skapar webbplatsens HTML-sidor.
PHP är ett mångsidigt, dynamiskt programmeringsspråk som kan bearbeta WordPress-förhör, utföra beräkningar och mer, men det kräver minne för att göra det.
WordPress’s default defined memory limit is 32 MB, men det är normalt om du behöver höja den. Till exempel rekommenderar WooCommerce en WordPress-minnesgräns på 64 MB.

När WordPress når standardminnesgränsen kommer den att försöka höja den till 40 MB för installationer på en plats och 64MB för multisite-installationer. Om det inte räcker kommer en rad med allvarliga felmeddelanden att visas.
Om du inte har installerat ett plugin som kräver mer minne, en minnesgräns på 128 MB borde räcka för de flesta sidor. Installera Server IP och minnesanvändning Display plugin för att se hur mycket minne varje plugin förbrukar.
Du kan inaktivera plugins för att se hur de påverkar minnesanvändningen efter att du aktiverat Server IP och minnesanvändning Display plugin. För att undvika att överbelasta din server, hög kvalitet, allt-i-ett-plugins kan effektivt använda minnet.
Varför kräver WordPress mer minnesgräns, till att börja med?
För att öka minnesgränsen måste man öka den maximala uppladdningsstorleken i WordPress wp-config.php minnesgränsfil.
Det finns dock ett problem du bör vara försiktig med. Att öka minnesgränsen kommer att göra WordPress ineffektivitet svårare att identifiera.
Innan du ökar WordPress-minnesgränsen rekommenderar jag att du Försök först ta reda på vad som förbrukar mer minne. Mer resurser som kastas på ett problem kan ibland sluta kosta mycket mer på lång sikt, särskilt om du har planer på att uppgradera värden.
Ineffektivitet i WordPress kan leda till en trög sida och en dålig användarupplevelse. Men för att få lösningen måste du identifiera roten till problemet, vilket kan hjälpa dig att lösa en mängd olika problem på vägen.
Bara 4.4% av WordPress webbplatser använd den senaste versionen av PHP, och 64% använder den äldre versionen som inte längre får aktiva uppdateringar.
Att uppgradera din värdservers PHP till den senaste versionen skulle göra WordPress mer effektivt och eliminera behovet av att öka minneskapaciteten i WordPress.
Vad är den maximala uppladdningsgränsen i WordPress?
Den maximala uppladdningsgränsen i WordPress avser den största filstorleken som WordPress kan acceptera för uppladdningar. Den maximala uppladdningskapaciteten i WordPress kan hittas på uppladdningsskärmen för mediabiblioteket.
Även om detta är fördelaktigt för din värd, förbättrar det också effektiviteten på din webbplats. Stora bildfilsuppladdningar fungerar till exempel dåligt på din webb eftersom de tar lång tid att ladda ner och presentera.
🤷♀️ Tänk på:
Innan du spenderar mer pengar på frågan och höjer WP-minnesgränsen, se om det finns något du kan göra för att minska filstorleken först, precis som du gjorde med minnesgränsen.
Om dina bilder är lite för stora för sin behållare eller om du inte har komprimerat dem, kan du åtgärda dessa problem först eftersom de åtgärdar roten till problemet, vilket inte förbättrar dina tillgångar ordentligt. För mer information, se vår guide om hur du kan snabba upp din webbplats.

Vanliga frågor
Does WordPress memory limit effect performance?
Yes. A low WordPress memory limit slows down PHP execution, causes fatal errors, and prevents plugins and themes from running smoothly that directly impact site performance.
Is 256M enough?
For most WordPress sites, 256M is sufficient. However, hypermedia-heavy sites, WooCommerce stores, or sites using advanced page builders may require more memory.
How to check current WordPress memory limit?
You can check the WP memory limit from wp-config.php file. In this file, you will find a line similar ( ‘WP_MEMORY_LIMIT’ , ‘128MB’ ). This means your WordPress memory limit is 128MB that you can further change by editing your WordPress PHP or other files.
Vad är skillnaden mellan WP_memory_limit och WP_max_memory_limit?
WP_memory_limit indikerar till frontend-minnesgränsen. Å andra sidan hänvisar WP_max_memory_limit till PHP-minnesgränsen som är tilldelad för utveckling av backend.
What does Memory_limit=-1 mean in PHP?
Memory_limit= -1 är inställd för att undvika att använda allt minne av dåligt skrivet PHP-skript. Det betyder att PHP-skript inte får använda överdrivna serverresurser och leda till prestandaproblem.
Avslutar
Det kan vara nervkittlande att konfigurera servern och ta itu med fatala fel att öka minnesgränsen på WordPress-webbplatsen. Proceduren du måste följa är starkt beroende av vilket webbhotell du väljer, varför det är så viktigt att få en pålitlig värd. De hjälper dig att hitta och ändra inställningarna som behöver ändras för att öka PHP WordPress-minnesgränsen.
Öka dock wp-minnesgränsen för din webbplats via wp-config minnesgränsfilen är den enklaste metoden du kan lita på, de andra två kan vara lite längre.


Lämna ett svar