The “memory limit” error in WordPress often occurs when your website uses more memory than allowed by the server configuration. To fix this issue and increase the memory limit, follow this step-by-step tutorial:
Step 1: Identify the Current Memory Limit
Before making any changes, you need to identify the current memory limit of your WordPress site. To do this, create a PHP file called info.php
and upload it to your WordPress root directory using FTP. The file should contain the following code:
<?php
phpinfo();
?>
Save the file and then access it through your web browser by visiting http://yourdomain.com/info.php
. Look for the memory_limit
value, which will indicate the current memory limit for your website.
Step 2: Verify Server Requirements
Make sure your server meets the minimum requirements for running WordPress. Check with your hosting provider to ensure that your server supports the necessary PHP version and configuration.
Step 3: Create a php.ini File
If your server allows custom PHP configuration, you can increase the memory limit by creating a php.ini
file. Create a plain text file called php.ini
and add the following code:
memory_limit = 256M
Replace 256M
with the desired memory limit (e.g., 512M) based on your needs. Save the file.
Step 4: Upload the php.ini File
Upload the php.ini
file to your WordPress root directory using FTP. If there is already a php.ini
file present, you can edit it instead of creating a new one.
Step 5: Modify .htaccess File
If you cannot use a php.ini
file, you can try modifying the .htaccess
file to increase the memory limit. Access your WordPress root directory and find the .htaccess
file. Add the following code at the end of the file:
php_value memory_limit 256M
Replace 256M
with your desired memory limit. Save the changes.
Step 6: Edit wp-config.php
If the above methods didn’t work, you can increase the memory limit directly from the wp-config.php
file. Access your WordPress root directory and find the wp-config.php
file. Open it in a text editor and add the following code just before the line that says “That’s all, stop editing!”:
define( 'WP_MEMORY_LIMIT', '256M' );
Replace 256M
with your desired memory limit. Save the file.
Step 7: Check for Plugin or Theme Conflicts
Sometimes, memory limit errors can be caused by poorly coded plugins or themes. Deactivate all plugins and switch to a default theme (e.g., Twenty Twenty-One). If the memory limit error disappears, it means one of the plugins or the theme was causing the issue. Reactivate each plugin and theme one by one to identify the problematic one.
Step 8: Contact Your Hosting Provider
If you’ve tried all the above steps and are still encountering memory limit errors, it’s possible that your hosting provider has a limit set that cannot be overwritten. In this case, reach out to your hosting provider’s support team and ask them to increase the memory limit for your website. If you are still unable to resolve the issue then Contact us for our professional service for further assistance.
Conclusion
By following these step-by-step instructions, you can increase the memory limit and fix memory limit errors in WordPress. Increasing the memory limit can improve the performance and stability of your website, especially if you are running resource-intensive plugins or themes. Remember to always backup your website before making any changes to avoid data loss.
If you require professional assistance is setting up or customizing your WordPress site, our team at The FAS Solutions is here to help. Whether you need development services, design support, or any other related assistance, please feel free to Contact us.