0

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
moTHO.
  • 364
  • 3
  • 21
  • Try adding `ini_set('memory_limit', '-1');` at the top of the .php file which probably will make it work. But it would be a great idea to search it further just FYI – Antonios Tsimourtos Apr 04 '17 at 10:55
  • That's not a real fix, this is just causing that my webserver is going to use all of its 8GB ram.. – moTHO. Apr 04 '17 at 11:06
  • You said you added a new action. Either RAM is not enough, or you could find another way doing what you do which will proccess it better. Is that action a "big thing"? If it's proccessing big files for example you will need more memory. This is how is supposed to be. You could set `ini_set('memory_limit', '1024M');` .If 8 GB is not enough, then you should upgrade the system otherwise remove that functionality. – Antonios Tsimourtos Apr 04 '17 at 11:19
  • Actually it's not a big thing at all, it should simply deliver a html response with a template (without any rendering or something) – moTHO. Apr 04 '17 at 11:21
  • Read [this](https://www.airpair.com/php/fatal-error-allowed-memory-size) on section 2. Maybe the way you process it causes this error. – Antonios Tsimourtos Apr 04 '17 at 11:22
  • 1
    You should look in your code and in your profiler. – symcbean Apr 04 '17 at 12:04
  • Thanks guys, I found the error: My classfactory was set wrong and tried to load itself all the time :D Dumb autocompletion :( – moTHO. Apr 04 '17 at 12:05

1 Answers1

0

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.

moTHO.
  • 364
  • 3
  • 21