If WordPress show a message error “Fatal error: Allowed memory size”, for example to add a picture or installing a new plugin in your wordpress account. This is because you are exceeded memory limit reserved to PHP and you need increase it. I propose different solutions.
Solution at WordPress error «Fatal error: Allowed memory size»
Login via FTP client (Filezilla for example) to your hosting account and try to solve the problem
with one of the following solutions:
- Edit wp-config.php file, the file is in the blog root folder and add at the end define(‘wp_memory_limit’,’XXM’); where XXM is the amount of memory you need:1234567/** WordPress absolute path to the Wordpress directory. */if ( !defined('ABSPATH') )define('ABSPATH', dirname(__FILE__) . '/');/** Sets up WordPress vars and included files. */require_once(ABSPATH . 'wp-settings.php');define('wp_memory_limit','80M');
If you don’t solve the problem, try with define(‘WP_MAX_MEMORY_LIMIT’, ‘XXM’)1234567/** WordPress absolute path to the Wordpress directory. */if ( !defined('ABSPATH') )define('ABSPATH', dirname(__FILE__) . '/');/** Sets up WordPress vars and included files. */require_once(ABSPATH . 'wp-settings.php');define('WP_MAX_MEMORY_LIMIT', '80M'); - Edit .htaccess file, this file is in the blog root folder (probably hidden)
and add the code line php_value memory_limit XXM:123456789<IfModule mod_rewrite.c>php_value memory_limit 64MRewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule> - Try to increase a memory specified in the default-constants.php file,
this file find it in wp-includes folder. Edit line 9 where in the example
is define(‘WP_MEMORY_LIMIT’, ’48M’); and especified increasing the memory you need:123456789101112131415function wp_initial_constants() {global $blog_id;// set memory limitsif ( !defined('WP_MEMORY_LIMIT') ) {if( is_multisite() ) {define('WP_MEMORY_LIMIT', '64M');} else {define('WP_MEMORY_LIMIT', '48M');}}if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {define( 'WP_MAX_MEMORY_LIMIT', '256M' );}
If your wordpress install is multisite, then modify line 7 where in the example is define(‘WP_MEMORY_LIMIT’, ’64M’);