Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder Coastal Web's Avatar
    Join Date
    Oct 2004
    Posts
    225
    Thanks
    12
    Thanked 3 Times in 3 Posts

    ini_set() an unlmited memory_limit question

    Hi guys, l have a quick question, will using this in the top of your php script:
    Code:
    ini_set("memory_limit","0");
    Make it so your php script has no memory_limit, or do you have to give it an actual number like this?

    Code:
    ini_set("memory_limit","999999999M");

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    In theory, yes (according to what I've read about it). Setting the memory limit to zero will make it unlimited up to your hardware's max.

    In practice, I don't exactly know. I have never actually tried it.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • Users who have thanked Rowsdower! for this post:

    Coastal Web (03-24-2010)

  • #3
    Regular Coder Coastal Web's Avatar
    Join Date
    Oct 2004
    Posts
    225
    Thanks
    12
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by Rowsdower! View Post
    In theory, yes (according to what I've read about it). Setting the memory limit to zero will make it unlimited up to your hardware's max.

    In practice, I don't exactly know. I have never actually tried it.
    Thanks!

    PS> IMHO you should add outline:none; to your default css reset (in your sig). I hate those dang outlines, especially when their on image replaced links using text-indent: -999px to hide the text

    Code:
    * {border:0;margin:0;padding:0;outline:none;}

  • #4
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by Coastal Web View Post
    Thanks!

    PS> IMHO you should add outline:none; to your default css reset (in your sig). I hate those dang outlines, especially when their on image replaced links using text-indent: -999px to hide the text

    Code:
    * {border:0;margin:0;padding:0;outline:none;}
    No problem.

    Oh and I often do use outline:none; actually, but you have to be careful to make sure that a similar functionality is put in its place with :active styles (for accessibility/user-friendliness reasons). Because of that I don't really include it in the default reset that I recommend to others since there isn't enough room in the sig to properly caution them about it.

    I usually figure that they can discover that option on their own in good time.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #5
    Regular Coder Coastal Web's Avatar
    Join Date
    Oct 2004
    Posts
    225
    Thanks
    12
    Thanked 3 Times in 3 Posts
    Good points and nice snippet! Thanks.

    Regards,

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by Coastal Web View Post
    Hi guys, l have a quick question, will using this in the top of your php script:
    Code:
    ini_set("memory_limit","0");
    Make it so your php script has no memory_limit, or do you have to give it an actual number like this?

    Code:
    ini_set("memory_limit","999999999M");
    I believe a memory limit of 0 is just that, no available memory to use. To use max memory available (quite unwise, so make sure you control it well), use -1 as you're memory limit; make sure its an integer -1 and not a string -1M for example.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Whoopsie, you're right! According to the documentation:

    Resource Limits
    Resource Limits Name Default Changeable Changelog
    memory_limit "128M" PHP_INI_ALL "8M" before PHP 5.2.0, "16M" in PHP 5.2.0


    Here's a short explanation of the configuration directives.


    memory_limit integer
    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.

    See also: max_execution_time.
    Sorry about that!
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •