I have a strange memory limit issue in PHP. I have to read a lot of data into an array using a particular script, and I keep running out of memory.
My memory is now at 2048M in the php.ini file, and phpinfo() indicates it as such, yet, I keep getting this error:
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 142610432 bytes) in ... on line 173
Now - those two total about 680MB. This is far below the limit I set it to. Why would this error still occur?
ini_set("memory_limit" , "2048M");in most cases this will overwrite all other configuration. Is that what you mean within the config filephp.inis for CLI and webserver.phpinfo()should tell you which one it usesphpinfo()isn't totally telling us the correct value, I would try and search recursively in all config files below/etcwith a tool such asrg(ripgrep). You could docd /etcand then simplyrg memory_limit. You might have to do it under your document root also.