How to Increase the WordPress Memory Limit to 256MB
If you’re experiencing issues with your WordPress site due to insufficient memory, you can increase the memory limit to improve performance. This tutorial will show you how to increase the WordPress memory limit to 256MB using several methods.
Step 1: Backup Your Site Before making any changes, it’s always a good idea to create a backup of your site in case anything goes wrong. You can use a plugin like UpdraftPlus or BackWPup to create a full backup of your site’s files and database.
Step 2: Edit the wp-config.php File
- Connect to your site’s server using an FTP client like FileZilla or through your web hosting’s file manager.
- Locate the ‘wp-config.php’ file in the root directory of your WordPress installation.
- Open the ‘wp-config.php’ file in a text editor.
- Look for the line that says, “/* That’s all, stop editing! Happy blogging. */”
- Just before this line, add the following code:
define('WP_MEMORY_LIMIT', '256M');
- Save and close the wp-config.php file.
- Refresh your site to ensure that everything is working properly.
Step 3: Edit the PHP.ini File If the above method doesn’t work, you can try increasing the memory limit through the PHP.ini file.
- Connect to your site’s server using an FTP client or the file manager provided by your web host.
- Locate the ‘php.ini’ file in your server’s root directory. If you can’t find it, create a new file and name it ‘php.ini’.
- Open the ‘php.ini’ file in a text editor.
- Add or modify the following lines:
memory_limit = 256M
post_max_size = 64M
upload_max_filesize = 64M
- Save and close the PHP.ini file.
- Restart your web server or ask your hosting provider to do it for you.
Step 4: Edit the .htaccess File If neither of the above methods works, you can try increasing the memory limit through the .htaccess file.
- Connect to your site’s server using an FTP client or the file manager provided by your web host.
- Locate the ‘.htaccess’ file in your server’s root directory.
- Open the ‘.htaccess’ file in a text editor.
- Add the following lines at the end of the file:
php_value memory_limit 256M
php_value post_max_size 64M
php_value upload_max_filesize 64M
- Save and close the .htaccess file.
- Refresh your site to ensure that everything is working properly.
Step 5: Verify the Increased Memory Limit
- Log in to your WordPress admin dashboard.
- Install and activate the “WP-ServerInfo” plugin.
- Navigate to “Dashboard” > “WP-ServerInfo.”
- Check the “PHP Memory Limit” value to confirm that it now displays “256M.”
Step 6: Contact Your Hosting Provider If you’re still unable to increase the memory limit, contact your hosting provider for assistance. Some hosting providers have restrictions in place that prevent users from modifying server settings, and they may need to make the change on your behalf.
Conclusion: Increasing the WordPress memory limit to 256MB can help improve your site’s performance and resolve issues related to insufficient memory. Always remember to create a backup of your site before making any changes, and use the methods outlined above to increase the memory limit. If you need further assistance, don’t hesitate to reach out to your hosting provider.