One of the most common questions we are asked by WordPress beginners is: “Why can’t I add plugins in WordPress?”. It usually follows up with how the user is seeing an upgrade message or that their admin area doesn’t have the plugins menu.
The failure notice is usually caused by the PHP memory limit. There are settings in your WordPress hosting and inside your WordPress core that define the amount of memory a PHP script can use. When a process reaches this limit, it either gets terminated or it gives an error like this:
Fatal error: Allowed memory size of 67108864 bytes exhausted
The quick fix to this problem is increasing your PHP memory limit. You can do that by adding this line to your wp-config.php file:
define('WP_MEMORY_LIMIT', '256M');
When the following is added to the wpconfig.php file, it disables file editing and uploading.
define('DISALLOW_FILE_EDIT', true);
define('DISALLOW_FILE_MODS', true);
If found, simply change the values from true to false or even better delete those lines.