Site AI Auditвід Internet Solutions

PHP Memory Limit in WordPress: Errors, Causes and Safe Fixes

26 жовтня 2026 р.Час читання: 8 хвШвидкість сайту
PHP Memory Limit in WordPress: Errors, Causes and Safe Fixes

Short answer: The PHP memory limit is the maximum amount of memory a single PHP request may use. When WordPress needs more, for example during an import, an image upload or a heavy plugin task, PHP stops with an “allowed memory size exhausted” error. You can often raise the limit in wp-config.php or through your hosting panel, but a limit that keeps being hit usually points to a plugin or task that needs fixing, not just a bigger number.

What the memory limit is

Every time someone loads a page, the server starts a PHP process that builds that page. To protect the server, PHP gives each process a memory ceiling. If one request tried to use all the memory of the machine, it would slow down or crash every other site on it. The ceiling, set by the setting called memory_limit, keeps one misbehaving request from doing that.

The limit is not the same as the memory of your hosting plan. A server may have many gigabytes in total while each request is allowed only a few hundred megabytes. It is also not the same as disk space, which is where your files live. This confusion is behind many unnecessary support tickets.

How the error looks

The classic message reads something like “Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes)”. The first number is the limit in bytes and the second is the amount PHP tried to add when it ran out. Depending on your settings, you might see:

The file path in the message is the most useful clue. It shows which code was running when memory ran out, though not always which code used the memory.

Where the limits come from

Several layers set limits, and the lowest one wins. This is why a change in one place sometimes appears to do nothing.

How to raise the limit safely

If you only need a short increase, for example for a one-off import, try the simplest option first and move on if it does not work.

  1. Check the current value. The Site Health screen in WordPress shows the PHP memory limit under its server information. Note it before changing anything.
  2. Set it in wp-config.php. Add a line that defines WP_MEMORY_LIMIT with a larger value, such as 256M, above the line that says to stop editing. This works only if the host allows that much.
  3. Use the hosting control panel. Many panels have a PHP settings page where you can change memory_limit per site. This is often the cleanest option because the change lives in the right place.
  4. Ask the host. If neither option works, support can tell you the real limit of your plan and whether it can be raised or whether you need a larger plan.

Before editing wp-config.php, keep a copy of the original. A typing mistake in that file can take the whole site down. Our article on wp-config.php security hardening explains why the file deserves care in other ways too.

Avoid setting the limit to an extreme value to “fix it once and for all”. A very high limit hides runaway code, lets one request consume the resources shared with other visitors and may cause the server to kill the process anyway.

Finding the real cause

If the error returns after you raise the limit, treat that as information. Something is using far more memory than a normal page should. These are the usual suspects:

A safe way to test

Do not experiment on the live site if you can avoid it. Make a copy, or at least take a backup, and then repeat the action that triggers the error. Switch the theme to a default one and disable plugins in groups, repeating the action each time. When the error disappears, the last group you disabled contains the cause. Re-enable the plugins one by one to find the exact one, then check whether an update, a setting or an alternative solves it.

If the cause is a legitimate heavy task, such as a big import, see whether the tool can process data in smaller batches. Many import and backup plugins have a setting for this. Running the task outside business hours also lowers the chance that normal visitors are affected.

Signs you are close to the limit

Not every memory problem ends in a fatal error. A site that sits close to its limit often shows milder symptoms first. Updates fail now and then without a clear reason, a large upload works for small files but not big ones, and the admin area sometimes shows a white screen that goes away after a reload. Scheduled tasks may also stop running, because background jobs are subject to the same ceiling.

If you notice a pattern like this, check the server information in Site Health and the error log of your hosting account. Many hosts show the last fatal errors in the control panel. A few entries for the same plugin or task are a much better guide than guessing. Fixing the cause at this stage is easier and calmer than doing it in the middle of an outage.

Memory, speed and server errors

Memory problems rarely appear alone. A site that regularly runs near its limit often feels slow, because heavy requests take longer, and it may hit other limits too. If your host shows the “resource limit reached” message, read what a 508 error means. If only the admin area is slow, the guide to the slow WordPress dashboard is a better place to start. Using a current PHP version also helps, because newer versions are usually faster and more efficient, as explained in PHP version and performance.

How Site AI Audit helps

Site AI Audit does not read your PHP settings or measure memory use inside the server. It looks at the result from outside: the free check reports server response time, compression, page weight and the Google PageSpeed score with LCP, CLS and INP, each with a plain-language fix. A slow server response after a plugin change is a hint that something heavy is running on every request. The Monitor plan repeats the check every week and sends e-mail alerts when something breaks. You can run a free check of your website or see the plans.

Related reading

The bottom line

An exhausted memory limit is a warning, not only an inconvenience. Raise the limit in a controlled way so that the task can finish, then find out which plugin, import or image job needed so much. A sensible limit, a current PHP version and a lean set of plugins give you a site that is both stable and fast.

FAQ

What is a good PHP memory limit for WordPress?

For most small sites 256M is enough, and 128M often works for simple sites. Stores and page builders may need more, but a higher limit should follow a real need.

Why does the limit I set not change anything?

Another layer, usually the host, may enforce a lower value, or an override in a control panel or configuration file may take priority. Check Site Health to see the value actually in use.

Can a memory error be caused by a hack?

Occasionally, because malicious scripts can use a lot of memory. If the error appears together with strange files, new users or unexpected redirects, check the site for compromise.

Will a bigger limit make my site faster?

Not by itself. It only prevents failures when a task needs more memory. Speed comes from efficient code, caching and a good server.

Do I need a new hosting plan to fix it?

Sometimes. If the host caps memory on your plan and your site genuinely needs more, a larger plan may be the cleanest answer, but check plugins and tasks first.

#Troubleshooting#Web hosting#WordPress performance
Перевірте свій сайт — безкоштовно.Що виправити на вашому сайті — і з чого почати.
Почати безкоштовно

Ще з блогу

Усі статті →
Internet Solutions

Інші продукти нашої команди

Створено Internet Solutions. Спробуйте й інші наші продукти — кожен заощаджує час по-своєму.

internet-solutions.net ↗
01Автопостинг у соцмережі
PostRSS

Нові записи з вашого RSS-фіду автоматично публікуються у Facebook, X, LinkedIn, Telegram та ще 60+ мережах.

Безкоштовний тариф · з 2014Перейти →
02AI-чат для сайтів
Talkmio

Ваш сайт відповідає відвідувачам 24/7 на основі вашого контенту та їхньою мовою.

Безкоштовний тариф · без карткиПерейти →
03AI-асистент
Ask Mio

Чат, код, дизайн, тексти та дослідження. Mio добирає найкращу модель для кожного завдання.

Безкоштовний тарифПерейти →
04AI-автопілот для блогу й соцмереж
AI Blog Autopilot

AI пише SEO-статті на 2000–3000 слів і публікує кожну в 60 соцмережах.

Перші 3 статті безкоштовноПерейти →
05Глибокий SEO-аудит
Site SEO AI Audit

Повне SEO-сканування за 7 напрямами, зокрема видимість в AI-пошуку, з виправленнями за силою впливу.

Перший аудит безкоштовноПерейти →
06RSS і товарні фіди
RSS Feed Creator

Створюйте RSS з будь-якої вебсторінки, а також товарні фіди для Google і Meta, що оновлюються самі.

Безкоштовний тарифПерейти →
07Розробка сайтів і SEO
Internet Solutions

Сайти, інтернет-магазини та індивідуальні системи — проєктує, створює й супроводжує наша команда.

З 2011Перейти →