Trying to delete a post causes PHP Fatal error memory exhausted
-
Hi Hector,
WordPress Popular Posts plugin Version 7.0.1, then 7.1.0
WordPress version: 6.5.5
PHP version: 7.4.33I had a problem when trying to delete (bin) a post or page – it caused the dashboard to be replaced by a blank screen showing:
Fatal error: Allowed memory size of 402653184 bytes exhausted (tried to allocate 20480 bytes) in htdocs/wp-includes/functions.php on line 7181When I disabled the WPP plugin, I could bin a post as normal.
I saw another support topic mention to reset the cache by changing the setting Data Caching to Disabled on the WPP Settings | Tools page. I tried this, but when I clicked Apply, I got a similar Fatal error: memory exhausted error displayed in the dashboard, and the Data Caching setting was still set to “Enable Caching” when the dashboard was refreshed. I updated the plugin from 7.0.1 to 7.1.0, but the problem was still there.
I then added:
define( ‘WP_MEMORY_LIMIT’, ‘512M’ );
to wp-config.php to increase the memory limit in PHP (which was 384M), but this was not enough. Eventually I tried: define( ‘WP_MEMORY_LIMIT’, ‘1G’ ); and then it worked normally and the Data Caching setting was disabled. I then set it back to “Enable Caching” again. I could now also delete a post successfully without the PHP error occuring.I noticed that before I turned off Data Caching, the table wp_popularpoststransients in the database was quite large (there were 100k+ records created over the 3 months from when WPP was first installed). The tkey_date of the first record was dated from when the plugin was first enabled. After disabling and re-enabling Data Caching, the table had been cleared.
Although I’ve managed to fix my initial problem by increasing the PHP memory limit to a large size, I’m wondering if the large number of records in the wp_popularpoststransients table was causing a WP internal query to run out of memory? Is this table ever automatically pruned? If I leave the config as it is, will the number of records build up again in a few months and cause even a 1G memory limit to run out and the same problem will return? Or should I leave the Data Caching disabled (it was enabled by default when the plugin was installed)?
Thanks
Andrew
Plugin Configuration
Performance Nag: Dismissed
Log Limit: No
Log Views From: Everyone
Data Caching: Yes, 1 minute
Data Sampling: No
External object cache: No
WPP_CACHE_VIEWS: No
- You must be logged in to reply to this topic.