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

tptompkins's avatar

Valet and Memory Usage

Hey Guys -

I just installed Valet and was previously using Homestead to run my app. On Homestead, I didn't have any issues. But on Valet, I'm running into weird memory errors like the following:

FatalErrorException: Allowed memory size of 134217728 bytes exhausted (tried to allocate 48000001 bytes)

What's weird is that it's trying to allocate 48 MB but my allowed memory is set to 128 MB so it shouldn't have a problem. Is there something within Valet itself that is limiting the amount of memory that PHP can consume?

0 likes
6 replies
Snapey's avatar

sounds like you are trying to load a huge query into memory since php wants 40mb in one go.

128mb won't leave much headroom once all the framework is loaded, but it should be sufficient. check your queries.

tptompkins's avatar

No, it's not a query, but it is a large file upload. I'm using dropzonejs to upload files and everything works just fine if I upload files smaller than 2 MB. Anything over 2 MB and I start getting weird memory issues. The same exact code works great in Homestead and I have no problem uploading 30 MB files there.

ohffs's avatar

The default php setting for file uploads is 2mb and 128mb ram in total for a script, so you might have to edit your php.ini file. Have a look for upload_max_filesize, memory_limit and post_max_size.

1 like
Snapey's avatar

yep, homestead will be using php.ini on the VM, whereas using valet its your local php.ini

run php -i in both to compare

tptompkins's avatar

Well this was an idiot thing on my part. I was only looking at the memory_limit in php.ini but I completely forgot to look at post_max_size and upload_max_filesize. After setting both of those to 20M, everything is working well again.

However, it still doesn't explain the memory issue that I was getting before even though my memory_limit is set to 128M. Hmm..

Please or to participate in this conversation.