Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What does setting your memory limit to -1 do in php.ini for apache2.

I assume it just gives it unlimited memory but im not sure could anybody clarify? Dont want it chewing through all my memory ha!


share|improve this question
Hi :) Your question is a bit off topic for askubuntu and would probably be more suited to but I will try to answer your question anyway. Apache has a limited scope in how much memory you can set for scripts. 0 - 32. -1 is out of that scope, and I would imagine you would be getting some errors in your log if it was set as such. – loklaan Aug 28 '12 at 10:28
Its an ubuntu related question though? But i see your point. I have read the documentation and figured it out so ill answer it and post on more relevant stack exchange next time. Thanks – LinuxBill Aug 29 '12 at 13:15
up vote 0 down vote accepted

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.

Prior to PHP 5.2.1, in order to use this directive it had to be enabled at compile time by using --enable-memory-limit in the configure line. This compile-time flag was also required to define the functions memory_get_usage() and memory_get_peak_usage() prior to 5.2.1.

When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used.

This is a quote from php documentation. Basically its gives your php scripts access to as much memory as they need. Probably not good practice. But there you go.

Thanks Bill

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.