I have recently received a few complaints about users receiving fatal errors while activating plugins. Though this can basically be caused by two things one of them being a faulty plugin itself in which case you will get some error description along with line number etc in the plugin file.
The other reason could be no fault of either WordPress or the plugin itself but the amount of memory available to PHP for executing scripts. In such cases while activating a plugin you may come across fatal errors relating to high memory usage, a error similar to the one below.
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in /var/www/html/wordpress/wp-admin/admin- functions.php on line 864
In such cases it simply means that the memory size to execute this script has been exhausted and the engine cannot allocate more memory for the script to run.
How can you determine the amount of memory allocated?
There are several ways in which you can do that. I will list out the three basic ways in which you can do it. The first and most simple one is creating a simple PHP file and adding the code as shown below to it.
Once you have added the code save the file as test.php or whatever name you would like to give it and upload it to your web server using FTP. Once you have done that you can load the file in your browser. Once you have loaded the file you will see information about PHP that is running on your server. To find the exact amount of memory allocated to run PHP scripts you will need to find the text “memory_limit” without the quotes.
Many a sites do not allow you to run the the above code on the server so as a workaround you may try with the following code
Running the following code would return you with a out put of “The memory limit is 16M”.
The last and most advanced way to know this is information is looking into the php.ini file and finding the setting “memory_limit” without the quotes. If nothing works then you will have to contact the server administrator to know how much memory is allocated for running and executing PHP scripts.
How to fix this errors?
Many web sites are run on shared servers so in that case the best thing is to contact the system administrator asking them to increase the memory limit.
One of my readers Britt Malka has also suggested an alternate way to get rid of this problem but I am not sure if it works and have not tested it yet.
You can view the solution Britt used in the comments here.
If you know of any other solution please post it in the comments and let the readers know about it.



