In this article we will show you how to fix one of the most common WordPress errors – “Fatal error: Allowed memory size of xx bytes exhausted (tried to allocate xx bytes)”. If you see this error message, it means that your server has used up more memory than it is allowed to.
As a rule, the error occurs when PHP script is trying to load more data than the size defined in the PHP server memory limit. For example, while uploading a theme or installing the plugins within WordPress dashboard.
There are several ways of increasing memory limit on your server. We strongly recommend to back up any files you edit to be able to restore them.
- First try adding this line to your wp-config.php file:
define('WP_MEMORY_LIMIT', '128M');
2. If you have access to your PHP.ini file, you can change memory_limit value there. For example, if your line shows 32M, change it to 128M:
memory_limit = 128M ;
Maximum amount of memory a script may consume (128MB).
You can also manually create PHP.ini file on your server and add this line to the file:
memory_limit = 256M ;
Please note that you may need to restart your server before the php.ini settings take effect.
3. In case you do not have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 128M
If all the methods described above do not help, contact your hosting provider. They will check your server configuration and help you increasing memory size value for proper work of your website.