How to Reduce PHP 7+ and WordPress Memory Usage

If you are using shared hosting, VPS, dedicated or a cloud server, you will always have a limitation on the memory available.

Fatal error: Allowed memory size of 53556432 bytes exhausted (tried to allocate 9851348617 bytes) in /home/xxx/www/website/wp-includes/plugin.php on line xxx

  1. You need to increase PHP memory limit for wordpress by adding following code in wp-config.php

    define( 'WP_MEMORY_LIMIT', '256M' );

  2. If step 1 doesn’t work: disable opcache

    PHP newer version has default value as enabled and you can disable it by updating php.ini. Look for opcache.enable line, remove ; if its commented and set it to opcache.enable=0. Restart php fpm and apache process.