You may have seen the following error message while trying to access your WordPress site: “Fatal error: Allowed memory exhausted”. This error is caused by WordPress exhausting your server’s memory limit. By default, WordPress will try to use 32MB of memory for operations. However, some WordPress themes and plugins require more than that.
In this article, we will show you how to fix the memory exhausted error in WordPress by increasing the PHP memory limit. you can fix this error by .htaccess files or wp-config as well. This will require you to edit your WordPress site’s php file and add a line of code to it.
WordPress is a content management system (CMS) that enables you to create a website or blog from scratch or to improve an existing website. It’s extremely user-friendly and versatile, making it a popular choice for webmasters all over the world. One of the most common errors that WordPress users experience is the ‘memory exhausted’ error during installation of high size file like image, theme, plugins etc… This error is usually caused by a low PHP memory limit, which can be easily fixed by increasing the memory limit in the WordPress settings.
The recommended memory limit for WordPress is 64MB. By default, the memory limit for PHP is set at 32MB. Therefore, if you want to increase the memory limit in WordPress, you need to increase it to 64MB or as per need. To do so follow the instruction
Page Contents
How to access your WordPress file manger
To modifiying the code you need to access the WordPress file manager directory, you can either access file manager direct through your wordpress panel with the help of plugin ” File manager ” or you can access the root directory via cPanel: login your hosting account – go to cPanel and open file manager and then search mandatory files.
Increase wordpress php limit by .htaccess file
the .htaccess file is most important file in wordpress, this file control the site’s configuration including, redirection, gzip, security, memory limit and much more. To access this file, you can go with your cPanel’s file manager or FTP. and paste this single line code at bottom of all codes.
php_value memory_limit 128M
Increase wordpress php limit by wp-config.php file
wp-config.php is one of the most popular WordPress files for manipulation. you can found this in root directory of your wp file system. edit the wp-config.php file and upload limits on the wp-config.php memory file, as we early discussed 64MB is default size in wordpress you can make changes according as per need.
define('WP_MEMORY_LIMIT', '64M');
Once you add this line of code, save your changes and upload the wp-config.php file back to your server. You have successfully increased the memory limit in WordPress. If you are facing the memory exhausted error in WordPress, you can fix it by increasing the PHP memory limit far again. This can be done by editing the wp-config.php file or by changing the memory limit in the .htaccess file. If you are still having trouble, you can watch a video tutorial on how to increase the PHP memory limit.
Conclusion
Increasing wordpress php limit is easy by adding a single line code in wp-config file and there are another method mention in this article. You can go with plugin for the same if you are not familiar with Cpanel or hosting panel. I hope you like this article comment me if i missed something.