PHP Fatal error: Allowed memory size exhausted.
PHP Fatal error: Allowed memory size of xxxxxxxxx bytes exhausted.
This message indicates a PHP Fatal Error due to the exhaustion of the allowed memory.
Exhaustion of PHP memory limit is a common issue in WordPress, and it often requires adjusting the memory limit to resolve it.
Here's a step-by-step guide to increasing the memory limit:
Method 1: Editing wp-config.php
Access your WordPress files: Use an FTP client or file manager provided by your hosting provider to access your website's files.
Locate wp-config.php: This file is in the root directory of your WordPress installation.
Edit wp-config.php: Add the following line just before the line that says /* That's all, stop editing! Happy blogging. */:
define('WP_MEMORY_LIMIT', '256M');
This line sets the memory limit to 256MB. You can adjust this value according to your requirements (e.g., 512M, 1024M).
Save the changes: Upload the modified wp-config.php file back to your server.
Check if the issue is resolved: Visit your site and try accessing the page that was causing the error. If the error persists, consider the alternative method.
Method 2: Editing php.ini
Locate php.ini: Some hosting providers allow access to a php.ini file. If you can find it in your hosting control panel or via FTP in the root folder, proceed.
Edit php.ini: Find the line that specifies memory_limit and increase its value. If it's not present, add the following line:
memory_limit = 256M
Again, adjust the value as needed.
Save the changes: Save the modified php.ini file.
Restart your web server: In some cases, changes to php.ini require a server restart to take effect. Check your hosting documentation or control panel to restart the server.
Check your site: Verify if the error has been resolved by accessing the page that previously triggered the memory error.
Method 3: Contact Hosting Support
If you don't have access to these files or if modifying them doesn’t resolve the issue, contact your hosting provider's support team. They can assist in increasing the PHP memory limit or identifying any server-related issues causing the error.
Remember to keep backups before making any changes to your site's files, especially if you're not familiar with the process.