How to recover from a fatal error “Allowed memory size exhausted”

前端 未结 7 897
梦如初夏
梦如初夏 2021-01-04 08:52

Do you know any solution to recover from the PHP fatal error : \"Allowed memory size ... exhausted\"

I have a shutdown function that is called when a fatal

7条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-04 09:20

    This error is a fatal error - that means you cannot recover from it. If PHP has hit it's memory limit, it won't be able to allocate any more memory to create your exception and any other memory it needs to carry on its execution.

    There is another type of error - "catchable fatal error" which as the name suggests, can be caught in a try/catch, but unfortunately the memory size allocation is not one of them.

提交回复
热议问题