PHP memory_limit

Discussion in 'Install/Configuration' started by DoM, Nov 20, 2010.

  1. DoM

    DoM New Member

    Hi,
    on php.ini memory_limit is 64MB

    on litespeed i leave default directives about ram usage.

    One customer complain about this:

    Fatal error: Out of memory (allocated 18350080) (tried to allocate 30720 bytes) in /home/xxxxx/public_html/administrator/modules/mod_menu/helper.php on line 279

    No where inside .htaccess in his home dir there were limit about or any custom php.ini present.

    If i switch to Apache everything works.


    Waiting for your reply

    Regards
  2. webizen

    webizen New Member

  3. DoM

    DoM New Member

    Hi,
    i do not understand where to check this value inside lite speed admin panel.

    Can you please point me to right directive ?


    Waiting for your reply

    Regards
  4. NiteWave

    NiteWave Administrator

    access a php script with following content:
    PHP:
    <pre>
    <?php
    system
    ("ulimit -a"); 
    ?>
    </pre>
  5. DoM

    DoM New Member

    core file size (blocks, -c) 0
    data seg size (kbytes, -d) unlimited
    scheduling priority (-e) 0
    file size (blocks, -f) unlimited
    pending signals (-i) 71680
    max locked memory (kbytes, -l) 32
    max memory size (kbytes, -m) 524288
    open files (-n) 6000
    pipe size (512 bytes, -p) 8
    POSIX message queues (bytes, -q) 819200
    real-time priority (-r) 0
    stack size (kbytes, -s) 8192
    cpu time (seconds, -t) unlimited
    max user processes (-u) 1240
    virtual memory (kbytes, -v) 460800
    file locks (-x) unlimited

    Waiting for your reply

    Regards
  6. NiteWave

    NiteWave Administrator

    the output shows max memory can be 460M > 64M

    can the customer's issue be reproduced ? is the test script under the customer's document root ?
  7. DoM

    DoM New Member

    Yes error still present and script is inside document_root of user.


    Waiting for your reply


    Regards
  8. webizen

    webizen New Member

    Basically the php code in question requested 18MB memory but system doesn't have that much available for it (~30KB short) at the time. If this doesn't always happen when the code runs, you may consider raising memory softlimit/hardlimit for External App in LSWS (console->server(or vhost)->Ext App) to work around it. Otherwise, it is better to have customer optimize their php code to avoid large memory allocation.

  9. DoM

    DoM New Member

    Hi,
    but right now i have these settings about memory usage:

    Memory Soft Limit (bytes) 450M
    Memory Hard Limit (bytes) 500M

    So i do not understand why 20MB is a limit ?

    i understand that with those settings above process can use maximum 500MB and not maximum 20MB


    Waiting for your reply

    Regards
  10. mistwang

    mistwang LiteSpeed Staff

    You have memory_limit set to 64M in php.ini .
  11. mistwang

    mistwang LiteSpeed Staff

    You have to raise memory_limit in php.ini even though the error message showing the limit has not been met. It is PHP internal thing.
  12. DoM

    DoM New Member

    Hi,
    i know but 64MB > 20MB as php script reports.


    So also if there is a limit of 64MB why script stop execute when reach 20MB ?


    Waiting for your reply

    Regards
  13. mistwang

    mistwang LiteSpeed Staff

    You should ask this question to PHP developers. bug.php.net
  14. mistwang

    mistwang LiteSpeed Staff

    And the PHP script can modify the limit from PHP code, if it does not work after raising the limit, still only get around 18M, you need to look into possible memory limit configuration of the PHP application.

Share This Page