At times, your site may run low on memory thereby rendering a fatal error. Below is such an error:
”Fatal error: Allowed memory size of 43556932 bytes exhausted (tried to allocate 3679656 bytes) in public_html/wp-includes/plugin.php on line 56”
This error may occur when you try to install the theme or plugins within your site depending on the default set memory limit within your WordPress install. In the instance that you encounter such an error, it is actually possible to have this resolved using various approaches. Below, we will look into two ways that you can have this fixed:
i) By editing the wp-config.php file
The wp-config.php file is located within the root of your WordPress file. In order to access it, you will need to access your site files via FTP or your hosting panel and trace the file first.
-Right click on the file and select the edit option.
-Upon opening the file, search for the line below:
/* That's all, stop editing! Happy publishing. */
– Above this line, add the following code:
-Below is a sample screenshot on this:
-Save your changes.
ii) By editing the PHP.ini file
In a case where editing the wp-config.php file does not help, you may try editing the php.ini file.
The file can be found within WordPress installation’s root directory. You can access your site root files via FTP. Upon tracing the file, carry out the following:
– Open the file using your favorite editor
-Search for the line below:
‘memory limit = 32M’
It may also contain another value.
– Alter the value in place to for example 256M or 512M
– Save your changes
– Have your host restart your server
If your host supports a hosting panel such as cPanel, you can directly edit the file from cPanel. Upon accessing the cPanel dashboard, you can carry out the following:
– Select the “MultiPHP INI Editor”
-You can then change the set memory limit value and specify your desired memory limit value within the memory_limit row.
-Save your changes.