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?
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.
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.
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..