Before you change the memory limit you should check if your code needs that much memory in the first place. It's a very unusual scenario for that to be the case - usually this is an indicator of:
1) incorrect config elsewhere, e.g. in webserver
2) inefficient management of resources in your code
3) unbounded loops/recursion