avizzzy
avizzzy

Reputation: 535

Can PHP 'out of memory' error be caused by MySQL server limitation?

I am using AWS to host some of our WP (WordPress) instances and one such WP instance crashes frequently due to one of the plugins that are being used for localization (apache logs points to the plugin). The plugin is known for moderate memory consumptions and the only solution they provide in their forum is to up the PHP memory limit. I have allocated PHP memory limit per WP instance and I have increased the memory limit of the problematic WP instance from 256MB to 1024MB. But the problem still continues and it does not seem like the memory increase is making any difference. I continue to get the following error,

[Wed Oct 11 18:35:23.613853 2017] [proxy_fcgi:error] [pid 32458:tid 140165586614016] [client 157.55.39.157:17401] AH01071: Got error 'PHP message: PHP Fatal error:  Out of memory (allocated 20971520)
(tried to allocate 589824 bytes) in /htdocs/wp-content/plugins/wpml-string-translation/classes/filters/db-cache/class-wpml-st-db-translation-retrieve.php on line 186\n'
[Wed Oct 11 18:37:32.626994 2017] [proxy_fcgi:error] [pid 1040:tid 140165435545344] [client 157.55.39.157:12926] AH01071: Got error 'PHP message: PHP Fatal error:  Out of memory (allocated 46137344) (
tried to allocate 8192 bytes) in /htdocs/wp-includes/wp-db.php on line 1851\nPHP message: PHP Fatal error:  Out of memory (allocated 46137344) (tried to allocate 36864 bytes) in /htdocs/wp-includes/functions.php on line 3721\n'

Now what's interesting in the above log is that the first entry is always related to the problematic plugin (WPML) and the next entry points to the wp-db.php file.

I do know how PHP memory consumption and management takes place, but I would like to know is that whether the "out of memory" could actually be caused by the MySQL server limitations. I am using an AWS RDS instance to host the databases. Could it be that the database server specification is not sufficient that it creates a bottleneck and causes the PHP out of memory issue, therefore the changes I made in PHP memory size did not really matter, as the issue lies on the Database server end?

Upvotes: 1

Views: 644

Answers (1)

JamesKn
JamesKn

Reputation: 1045

"I do know how PHP memory consumption and management takes place, but I would like to know is that whether the "out of memory" could actually be caused by the MySQL server limitations. I am using an AWS RDS instance to host the databases."

No in generally, if you were popping the memory on the RDS then you would see that clearly in the RDS monitoring on AWS console. Check to see what you have left.

The next steps I would go to would be to put some monitoring into the box that hosts WordPress.

Assuming you have access completely to the box tools like

https://www.newrelic.com

https://docs.newrelic.com/docs/agents/php-agent/frameworks-libraries/wordpress-specific-functionality

https://www.datadog.com

To name just two popular version of server monitoring software. They should help you identify process and time that are consuming memory on the box. Which should help you identify the problems you are having in more depth and give you clear indication of what is causing a memory leak or taking all the memory on the box.

hths,

James

Upvotes: 1

Related Questions