admin管理员组文章数量:1122832
I have struggled with this for hours and days. I need good ideas for a fix now.
When I do a certain action in WordPress, I sometimes get a Fatal memory error. The error comes after I hit "Update" on a tag/term. The error seems to be related to a WordPress core file.
It looks like that the script hit a memory limit at around 700 MB:
However, the limit on the server is much higher - 5096 MB:
Our server administrator has confirmed that we do not hit any limit at their end.
What I have tried:
- Deactivating all plugins and switch to default theme. That solves the problem
- However: It is impossible to identify the problem to one single plugin. Different combinations of plugins gives the error.
- Switching to PHP 7.1 solves the issue. However that's not a permanent, good solution.
Can there be a "fake" memory limit in some script, plugin etc.? We do use LiteSpeed Cache on the server - I do not know if that's relevant.
Any ideas and suggestions are appreciated.
I have struggled with this for hours and days. I need good ideas for a fix now.
When I do a certain action in WordPress, I sometimes get a Fatal memory error. The error comes after I hit "Update" on a tag/term. The error seems to be related to a WordPress core file.
It looks like that the script hit a memory limit at around 700 MB: https://www.screencast.com/t/i6USBKHuWcxS
However, the limit on the server is much higher - 5096 MB: https://www.screencast.com/t/CyRJs8dohYYh
Our server administrator has confirmed that we do not hit any limit at their end.
What I have tried:
- Deactivating all plugins and switch to default theme. That solves the problem
- However: It is impossible to identify the problem to one single plugin. Different combinations of plugins gives the error.
- Switching to PHP 7.1 solves the issue. However that's not a permanent, good solution.
Can there be a "fake" memory limit in some script, plugin etc.? We do use LiteSpeed Cache on the server - I do not know if that's relevant.
Any ideas and suggestions are appreciated.
Share Improve this question asked Jan 14, 2021 at 10:57 pstidsenpstidsen 536 bronze badges 2 |1 Answer
Reset to default 2A server has to serve lots of requests at the same time, and to prevent a PHP request running out of control it gives them 2 limits. Time, and memory. If it takes 2 hours to generate a page request, something has gone wrong.
If your request requires endless amounts of memory, something else has gone wrong. These problems can lead to resource exhaustion attacks and damage a sites ability to scale. The limits provide a safety net to prevent disaster, avoid infinite loops, catch bugs, etc.
Normally a good memory footprint for a WordPress site is under 100mb, ideally under 50mb. A vanilla WP install with no plugins and the default theme comes inn at ~4mb, and a lot of well built sites are ~20mb.
Anything above 100 is suspect, and 700mb is extremely high. Your site is either doing too much, doing things it does not need to do, or has bugs. This could be your theme, or a plugin, or a combination of several factors. It doesn't have to be 1 single thing, it can be lots of things piling up.
Newer versions of PHP will help mitigate the problem, but raising the memory limit in php.ini
is only a stop-gap solution for most that doesn't fix the actual issue, which you have not found yet.
You need to grab a copy of your site, and attempt to profile it to get more information
The error seems to be related to a WordPress core file.
No, this is just what was happening when you ran out of memory.
A bit like the monty python scene where Mr Creosote has eaten everything in the restaurant and is offered a wafer thin mint, and explodes after eating it. It wasn't the mint that did it, it was the mountain of food. Likewise no individual piece of food was responsible, it was the combined bulk.
It looks like that the script hit a memory limit at around 700 MB:
700 is very high!
However: It is impossible to identify the problem to one single plugin. Different combinations of plugins gives the error.
You have too much stuff, get rid of some things or replace them with lighter less heavy things. Query Monitor can help you measure the memory used.
Switching to PHP 7.1 solves the issue. However that's not a permanent, good solution.
Actually this is a great move, but you did not go far enough. PHP 7.1 is old and unsupported, you should be on at least PHP v7.4 or newer.
However, the limit on the server is much higher - 5096 MB
You would never want a single request to actually use all of this.
But keep in mind just because the server has 5096 MB of RAM allocated, doesn't mean PHP is set to use it, PHP memory limit is independent of the hardware, and you want that since there are multiple PHP processes taking requests. Nobody wants their server to process 1 visit at a time!
本文标签: phpWordPress hit memory limit but not from the server
版权声明:本文标题:php - WordPress hit memory limit but not from the server 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736286433a1927669.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
php.ini
, but I would focus instead on lowering the memory footprint of your pages. Remember that web servers don't just handle a single request at a time, so if your page uses 5GB of memory and your server has 5GB, that means only one person can use the server at a time. It also takes time and resources to fill all that memory. Newer versions of PHP have smaller footprints and run faster, and PHP 7.1 is very old and unsupported – Tom J Nowell ♦ Commented Jan 14, 2021 at 11:32