I noticed recently on my WordPress website I\'m getting sometimes 500 Internal Server Error. I checked logs and I have many lines like:
[Mon Oct 03 01
The problem was caused by iThemes Security plugin. I turned off it and errors have gone. I'll investigate this problem more and edit this answer if I'll know what part of this plugin caused exceeding memory limit.
I had the same issue with "wp-db.php on line 1832" and disabling iThemes Security plugin as was mentioned before worked well for me. However, if you still need to protect your site it's not the solution.
What you need to do is to fix directory permissions of key areas such as wp-content, wp-includes etc...
Go to iThemes Security settings -> File Permissions (Configure Settings) and check if all permissions are set properly. Once you fix permissions as they supposed to be, you won't see that error anymore.
The constant WP_MEMORY_LIMIT
regulates RAM for all PHP processes for WordPress for the front and backends. Use this on shared hosting. The constant WP_MAX_MEMORY_LIMIT
regulates RAM for the backend only. You use WP_MAX_MEMORY_LIMIT
when you know you have enough RAM and can use it all, such as on a VPS server you administer.
Go back to
define( 'WP_MAX_MEMORY_LIMIT' , '128M' );
define( 'WP_MEMORY_LIMIT' , '64M' );
and remove those queries you are running (above) and see if the site comes back up. If it does, that's the issue; working on those queries is a different issue.
If this is shared hosting, you are killing the server with those queries; if this is your own server, you need to configure MySQL/PHP for caching and high loads.
Disable the "Database Backups" in iThemes Security works for me.