Search code examples
phpzend-frameworkmezzio

PHP - Allowed memory size exhausted (Zend Framework Expressive)


I'm currently struggling because of a new action in my zend expressive project. Can someone tell me, where to look at? I tried to comment out all the code in the new action but I always keep getting the following error for the route of this new action.

Can someone help me? I will deliver some more code, if you need. Thanks a lot!!!

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in D:\Apache24\htdocs\vendor\zendframework\zend-servicemanager\src\ServiceManager.php on line 200

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

Solution

  • Low RAM wasn't my problem.

    I had made a very big mistake in my ConfigProvider. Instead of declaring the factory like this:

    DashboardAction::class => DashboardActionFactory::class,
    

    I mistakenly just wrote:

    DashboardAction::class => DashboardAction::class,
    

    This was kind of an endless loop which explains the memory overflow.