Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

Thanks

share|improve this question
1  
Hi :) Your question is a bit off topic for askubuntu and would probably be more suited to webmasters.stackexchange.com 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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.