One common WordPress problem users may encounter, although not necessarily a critical one, is reaching the defined memory limit. By default, WordPress sets the PHP memory limit to 40MB (or 64MB for multisite installs). Depending on your server configuration, you might encounter the following message when trying to install plugins or themes that require more than 40MB of memory to operate effectively.
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/site/public_html/wp-includes/plugin.php on line xxx
If you have a very active website, the most efficient way to resolve this issue is to promptly remove the plugin or theme that has caused the problem through FTP or a web hosting file manager.
Next, you’ll want to increase the PHP memory limit on your installation, to do this open the WordPress configuration file (wp-config.php) found in the root of your WordPress installation and add the following line:
If you need more than 64M, you can consider using 128M, 256M, or 1024M. It is advisable to verify with your web host to determine the maximum limit available, most shared hosts permit up to 1024M. However, it is recommended to confirm the specific limit with your host.
This straightforward solution should resolve the issue. As mentioned, it is a common problem and there is no need to be concerned. If you require any assistance with this, please feel free to contact us.
Other ways of increasing the WordPress memory limit
You can also modify the PHP memory limit directly from your site’s .htaccess file. Navigate to the root folder of your website (typically public_html) and create a new .htaccess file if it doesn’t already exist. Then, include the following line in the .htaccess file:
php_value memory_limit 64M
Some web hosts may not give you access to modify the PHP.ini file for your website. But if you do have access, open the file and search for the property memory_limit and change the value to something greater like 64M.
memory_limit = 64M
If you are still seeing the error after applying this fix, then it will be a good idea for you to contact your web hosting company as they could have restrictions that do not allow you to modify memory limits manually and they may have to do this for you.