The Divi theme by Elegant Themes is one of the most comprehensive WordPress themes available today. It brings the best of two worlds together – a drag-n-drop page builder with the versatility of WordPress. But make no mistake, Divi is not a lightweight theme. All of the background processes needed to load the Page and Visual Builder require more resources than a typical WordPress theme – PHP memory in particular. If you’re reading this article, you might be experiencing that first hand.
If your Divi website is displaying an error message similar to this: “Fatal error: Allowed memory size of ….. bytes exhausted …“, you need to increase your PHP memory on your web server. Unfortunately, you’ll need to access your website’s files to fix the problem. This isn’t a problem you can fix from within the WordPress dashboard.
The easiest way to access your website’s files are by logging into your hosting account. Most hosts provide a way to modify files once logged in. For InMotion Hosting, Bluehost, HostGator, etc – you’re looking for the Cpanel. Other hosts like GoDaddy might have a custom hosting management interface. Follow the support instructions from your host to find the correct interface to edit your files. Once you’ve gained access to this area, you need to start by editing the wp-config.php file found in the root folder for your WordPress website.
Edit the wp-config.php file to avoid PHP memory errors
You’ll need to add the following line to the wp-config.php file:
Make sure you add it above this line that should already exist near the bottom of the file:
/* That’s all, stop editing! Happy blogging. */
Make sure you save the file. Now refresh your website. If it didn’t work, that means your host is limiting your server’s PHP Memory and not allowing WordPress to increase it. You’ll need to try editing the PHP.ini file.
Edit the PHP.ini file to avoid PHP memory errors
The PHP.ini file is a hidden file also located in the root folder of your WordPress website. If you can’t find it, make sure you have the option checked to view hidden files in Cpanel.
Once you find this file, edit it and search for a line similar to the following:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
The memory limit should be set to 256M:
memory_limit = 256M ; Maximum amount of memory a script may consume (256MB)
Make sure you save this file and refresh your website. If this file is not in your root folder, you may need to contact your host and have them add it. You can try editing your .htaccess file
Edit the .htaccess file to avoid PHP memory errors
The .htaccess file is another hidden file in the root folder of your WordPress website, so make sure you have the option checked to view hidden files in Cpanel.
Try adding the following line of code to the top of your .htaccess file:
php_value memory_limit 256M
Again, save this file and refresh your website.
If none of the options above worked, you’ll need to contact your hosting and request them to increase your PHP memory limit to 256M. This is a common request and should be easy for them to do. If you have other Divi WordPress websites on the same host, you should probably ask them to increase it for all websites. If you haven’t run into PHP memory issues with Divi yet, it’s only a matter of time (assuming your memory is less than 256M).