How to Solve PHP Fatal error Allowed memory size of bytes exhausted or if your website is not loading properly after installing WordPress's theme?
Why am I getting such an error after I have uploaded and install a theme on my WordPress or site?
An error such as:
Sample of the error:
- Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 4096 bytes) in /home/mysite/public_html//wp-admin/includes/update.php on line 753 on line 51
The likely causes for import/upload errors:
- PHP memory, max file upload size has limitation by default from the hosting provider to prevent excessive memory consumption
- By default, your hosting account has a PHP script memory limit of either 8M or 32M.
How do you fix the issue? recommend steps below:
If you get this error (Note: You might need to enable a debug mode in your WordPress's "wp-config.php" file in order to see the error if you do not see any error for debugging).
To enable a debug mode in your WordPress, edit the file "wp-config.php" and set the "define( 'WP_DEBUG', false );" to false if it's set to true by default.
Follow the steps below to fix the error:
- Login into your cPanel
- Under cPanel page navigate to "SOFTWARE" section - cPanel >> SOFTWARE >> MultiPHP INI Editor
- From the "MultiPHP INI Editor" page, make sure you select the "Basic Mode" menu.
- Under "Configure PHP INI basic settings" >> select the website domain from the dropdown lists.
- Locate "memory_limit" from the settings and increase the limit to desire (64M) is acceptable. If your WordPress requires more than 64M, check with your hosting provider to look into your website's requirements.
- Then click the "Apply" button to save the change.
- Confirm that your site is loading properly, if you still seeing the error, clear your browser cache