Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

skoobi's avatar
Level 13

Error 500, php memory limit again, on Digitalocean app platform

Hi. I have a Laravel app on the Digitalocean platform and its been fine for a while. Today out of the blue its hitting a error 500, I have no error logs in laravel that tell me what it is. I checked the runtime logs and thats showing PHP Fatal error: Allowed memory size of 134217728 bytes exhausted. I've delt with this issue several times over the years and theres plenty of posts here to explain how to sort, but unfortunelty no matter what I try, I either cannot edit the memory from 128M to 1024M so i can debug what the issue is. I cant edit the php.ini as each time I do it goes back to 128M

The issue I want to try to figure out is, When I goto the route that causes the issue, it errors, I added \Log::error(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 15)); to try and get a trace of whats happening and a good old dd("Here") in the controller, but it doesn't even get that far.

Any help or ideas would be greatful.

0 likes
5 replies
skoobi's avatar
Level 13

@jaseofspades88 Nope, unfortunately not. It seems like its hitting the issue before the route, but then its fine on all other requests. Im just in the process of adding a load of dd() after each stage to see where its getting to!

jaseofspades88's avatar
Level 51

If the rest of the application is running and it's just this one particular route, it screams of 'n + 1' issues. I'd imagine it's a complex database query that needs optimising or something that's taking too long. Typical culprits are usually no eager loading on a query or iterating over all the records in a collection to do something and going back to the database.

I can guess and guess and guess but without seeing code, I won't have a clue. One endpoint suggests one controller method... what is the purpose of the endpoint that's failing?

1 like
skoobi's avatar
Level 13

@jaseofspades88 Ye i guessed an n+1 so tried to remove the controller and just have a clean method to get an idea of what part of the code was causing it, but still got errors. I just had a thought .... As I'm editing the file in the DO console, I'm wondering if its actually writing the changes to disk! I may have to edit manually and then commit each time.. urgh...
I'll report back!

Many thanks

skoobi's avatar
Level 13

Incase anyone else runs into this issue where you're debugging through the DO console! You need to do it locally and push the changes. You can't edit files on the app platform directly. I'm not going to admit how long I was at that!

Please or to participate in this conversation.