What does memory_limit = -1 mean in a PHP.ini file?
I was in some ubuntu server configs, and found that my memory on the server (online resources say default is usually 128Mb correct?)
and I found this listed
memory_limit = -1
Why? What does a value of -1 do? Php of 5.6
From the official documantation here:
This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.
memory_limit = -1
Simply means to "have no memory limit" meaning: let the script use whatever is left over from the operating system and other important processes running. So if the machine has 4GIG and the OS + other processes use 2GIG, then your script will get the remaining 2GIG.
From the official docs and the important part is the last sentence!
memory_limit int
This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.
By memory i mean "RAM & Virtual mem"