This is a problem you will no doubt come across during your WordPress journey, the annoyance of the dreaded PHP memory limit error.
It is common but not serious and there is no way of knowing when it will happen.
WordPress by default is allocated 40MB (64MB for multisite installs) and depending on your server settings you may see the following message if you attempt to install plugins or themes that require more than 40MB memory to run.
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
If you have a very active website the quickest way to fix this is to quickly remove the plugin(s) or theme that has caused the problem via FTP, CPanel, or whatever file management tool your web host has available.
You can then proceed to increase the PHP memory limit on your installation by opening your WordPress configuration file wp-config.php and add the following line:
If you require more than 64M you can try using 96M or 120M.
Other ways of increasing the WordPress memory limit include:
You can also change the memory limit of PHP from your site’s htaccess file. Go to the root folder of your website (usually public_html) and create a new .htaccess file if it doesn’t already exist and add the following line:
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 this fix, then it will be a good idea for you to contact your web host as they could have restrictions in place which do not allow you to modify memory limits.