PHP Fatal error: Out of memory (Apache crash)

Discussion in 'Apache' started by solinem, Sep 29, 2008.

  1. #1
    Hi:
    I am trying to find a solution for this error that consequentially leads to Apache Server crash.
    Following is the message as seen in the error.log file:
    PHP Fatal error: Out of memory (allocated 786432) (tried to allocate 32768 bytes)

    SERVER CHARACTERISTICS:

    * Windows 2008 Enterprise Server
    * PHP 5.2.6
    * Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e
    * RAM=8gb,

    PHP SERVER PARAMETERS:

    * max_execution_time = 720
    * max_input_time = 360
    * memory_limit = 5120 MB

    After a few messages like this, the server ends with the message:
    [notice] Parent: child process exited with status 255 -- Restarting.

    Whenever it happens, I don't see a substantial rise in memory usage (well under the 5GB established in the configuration)
    I think part of the problem is originated because the server is not releasing memory, and the data is adding-up.
    It is surely a misconfiguration of my server
    I have searched everywhere but didn't found a satisfying solution.

    Thanks for your help.
     
    solinem, Sep 29, 2008 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    How much is the server ram .. it needs a increase
     
    Bohra, Sep 29, 2008 IP
  3. solinem

    solinem Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks,
    Maybe, It has only 8 GBytes, how much do I need, I think the limit fo my harware is 32GBytes
     
    solinem, Sep 30, 2008 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #4
    Depends on the site hosted on the server.. Try optimizing things
     
    Bohra, Sep 30, 2008 IP
  5. solinem

    solinem Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It is a dedicated server, only Apache/PHP, for my single application, the database is on another one.
    There are only 5 users! tha capacity should be at least 200 users?
    It is possible to see the code of the actual script being executed?
    The server works well for some hours, and after a while, it starts to log error messages:
    PHP Fatal error: Out of memory (allocated 6291456) (tried to allocate 393216 bytes) in...
    the quantity showed is variable.
    After 5-6 messages the server shuts-down with the following message:
    Parent: child process exited with status 1 -- Restarting.
     
    solinem, Sep 30, 2008 IP
  6. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #6
    The error "PHP Fatal error: Out of memory" is most likely related to memory_limit. If your script is trying to using more than allocated limit in memory_limit in php.ini, you will receive this error. Upload phpinfo page to your domain and verify that you have allocated sufficient value in php.ini. Do not forget to restart Apache after changing the value.

    Kailash
     
    kailash, Oct 5, 2008 IP
  7. mellow-h

    mellow-h Peon

    Messages:
    750
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Are you running suexec or suphp on the server?
     
    mellow-h, Oct 5, 2008 IP
  8. happpy

    happpy Well-Known Member

    Messages:
    926
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    120
    #8
    i think the
    memory_limit = 5120 MB
    is set up to high
    i once had problems with values over 900 megabyte
    also you most likely will never need such high ram for single php scripts.

    set this value to something like 800 mb and try again


    the error message says a lot of strange things
    786432 bytes is only ~800 kilobytes, 32768 bytes is only 32 kilobytes.
    if your server troubles at these low values, it is simply misconfigured.

    dont use extreme values in php.ini
     
    happpy, Oct 5, 2008 IP
  9. solinem

    solinem Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thanks
    I've already raised memory_limit up to 5120M but it seems Apache or PHP doesn't recognize such a large value because my Apache server crashes at about 2500MB of memory usage (of a total of 8GB available in RAM)
     
    solinem, Oct 8, 2008 IP
  10. solinem

    solinem Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Thanks,
    I have done, and will see if it helps.
    I think Apache is NOT RELEASING memory at a sufficient rate and it is BUILDING-UP.
    Is there any parameter I can adjust for this purpose?
     
    solinem, Oct 8, 2008 IP
  11. solinem

    solinem Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks,
    No, I'm using only the XAMPP distribution
     
    solinem, Oct 8, 2008 IP