The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP memory limit problem

Discussion in 'General Discussion' started by sampride, Aug 12, 2007.

  1. sampride

    sampride Member

    Joined:
    Jul 8, 2005
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    This server is running on php 5.2.3.

    Memory limit on phpinfo()

    memory_limit 128M 128M

    But somehow, my server error log having these error message, and the page appear to be blank. It said my allowed memory size is only 256k...:( please help.


    [Sun Aug 12 16:02:08 2007] [error] PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 1024 bytes) in /home/xxxx/public_html/wp-settings.php on line 154
    [Sun Aug 12 16:02:18 2007] [error] PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 44 bytes) in /home/aaaaa/public_html/init.php on line 38
     
  2. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    I think you are referring to apache memory and not php.


    You need to edit php.ini

    /usr/local/lib/php.ini
    or if you have zend extensions, use:
    /usr/local/Zend/etc/php.ini

    locate this setting and adjust accordingly:
    memory_limit =

    restart apache
     
  3. sampride

    sampride Member

    Joined:
    Jul 8, 2005
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    This is what I have in php.ini

    ;;;;;;;;;;;;;;;;;;;
    ; Resource Limits ;
    ;;;;;;;;;;;;;;;;;;;

    max_execution_time = 30 ; Maximum execution time of each script, in seconds
    max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
    memory_limit = 128M ; Maximum amount of memory a script may consume (32MB)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Error handling and logging ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
  4. sampride

    sampride Member

    Joined:
    Jul 8, 2005
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    Sometime it said im using 256k, sometime it said im using 128Mb

    PHP Fatal error: Allowed memory size of 262144 bytes exhausted

    PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1083190621 bytes)


    In php.ini it is 128Mb. The value changes whenever i restarted my apache
     
  5. maxtub

    maxtub Registered

    Joined:
    Aug 12, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
  6. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    128M is too high for a php process. Set it to 32M or lower.
     
  7. sampride

    sampride Member

    Joined:
    Jul 8, 2005
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    It's the same error pop out after I reset the apache limit. :(
     
  8. sampride

    sampride Member

    Joined:
    Jul 8, 2005
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    Problem solved, it is got to do with suhosin. I've disabled it.
     
  9. maxtub

    maxtub Registered

    Joined:
    Aug 12, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    http://forum.hardened-php.net/viewtopic.php?id=182

    read this, i think you shouldn't disable it. here is how you can raise the limit without disable it


    here is what i found from this forum
    Hi,

    I have php 5.2.0 with suhosin 0.9.16 , safe mode OFF , fedora core 5

    phpinfo() say:
    suhosin.memory_limit 0
    so it's default, but code:

    <?php
    echo "before: " . ini_get('memory_limit') ."<br>";
    ini_set('memory_limit','32M') ."<br>";
    echo "after: ini_set('memory_limit','32M'): " . ini_get('memory_limit');

    exit;
    ?>
    product output:

    before: 8M
    afret: 8M

    and write this to log:


    Dec 5 15:03:41 patrz suhosin[10917]: ALERT - script tried to increase memory_limit to 33554432 bytes which is above the allowed value (attacker '87.105.xx.xx', file '/home/patrz/www/test5.php', line 3)

    this is suhosin bug ?

    Last edited by shark (2006-12-05 13:11:17)

    Offline

    #2 2006-12-05 14:00:29
    sesser
    Moderator
    Registered: 2005-06-27
    Posts: 331 Re: can't change memory limitThis is not a bug but a documented feature:

    http://www.hardened-php.net/suhosin/con … mory_limit

    If the admin wants to allow violation of the memory_limit he mus configure the suhosin.memory_limit to a higher value. Otherwise the limit is the one on script start.

    Offline

    #3 2006-12-05 14:17:11
    shark
    New member
    Registered: 2006-07-30
    Posts: 5 Re: can't change memory limitit's works now,
    must be suhosin.memory_limit=32M not suhosin.memory_limit=32

    Last edited by shark (2006-12-05 14:18:18)
     
Loading...

Share This Page