This is because your PHP is configured to use only 8MB memory while executing any php script. But your script demanding another extra memory, and got crashed for this.
Why this problem happens? Why do you need 8MB memory for processing a script?
I'm giving an example about which reason this types of error can comes up. For example you are doing parsing process. You have got some HTML source inside your php variables and now performing some regular expression. See, you already have a very huge length of string, and now you are doing regex? So crashed out. If you need to find any link with huge data, just ask me, I have a lot of those.
How to fix the error?
Just simply put the below code inside your PHP script which need more memory.
If still crashing, just increase the memory. Or if you want to permanently increase the memory, you can change this from your PHP.ini script.
memory_limit = 12M
If you have root access, it is recommended to increase the memory as per your need.