The SimpleInvoices forum has moved to Google Plus - this forum is now read-only
Out of memory error
  • January 1970 Edit

    Hi,

    I just moved my site to a new server with php5.2 and am now getting out of memory errors. I was running on php4 with no problems like this.

    So I upgraded to the latest si version - no difference.

    My php.ini is set at 32M.

    I get the following error when trying to generate a pdf invoice (wah! I LOVE that feature)
    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77 bytes) in /home/blahblahblah/public_html/simpleinvoices/include/pdf/utils_units.php on line 70

    Any suggestions?
    Linda

  • justinjustin February 2008

    Hey Linda,

    hmm. 32M should be more than enough

    memory_limit = 24M ; Maximum amount of memory a script may consume (8MB)
    ;;;;;;;;;


    just double check it is the memory_limit setting in the .ini

    anyone else got this issue?

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • lvanderblvanderb February 2008

    Thanks Justin,

    In fact yes, well, I upped it to 64MB and am still getting:

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77 bytes) in /home//public_html/simpleinvoices/include/pdf/utils_units.php on line 70


    However, from the message, it looks like it's set at 32MB.

    I'm hosted with bluehost.com and they do permit use of php.ini, and I'm not sure if I need it in every folder.

    Here's the line in my php.ini

    memory_limit = 64M ; Maximum amount of memory a script may consume (8MB)


    Something weird is going on... I might ask bluehost.com then if nobody else has had this happen.

    Linda

  • lvanderblvanderb February 2008

    Checking the error log I see the following:

    [05-Feb-2008 08:17:36] Guessed: 'http://www.mysite.com/simpleinvoices/./templates/invoices/default/style.css'
    [05-Feb-2008 08:17:36] Fetching: http://www.mysite.com/simpleinvoices/./templates/invoices/default/style.css
    [05-Feb-2008 08:17:36] Status code:200
    [05-Feb-2008 08:17:36] Guessed: 'http://www.mysite.com/simpleinvoices/./templates/invoices/logos/_default_blank_logo.png'
    [05-Feb-2008 08:17:36] Fetching: http://www.mysite.com/simpleinvoices/./templates/invoices/logos/_default_blank_logo.png
    [05-Feb-2008 08:17:36] Status code:200
    [05-Feb-2008 08:17:37] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 24 bytes) in /home/mysite/public_html/simpleinvoices/include/pdf/list-style.image.php on line 13


    and
    [04-Feb-2008 12:42:59] Guessed: 'http://www.mysite.com/simpleinvoices/./images/logo/_default_blank_logo.png'
    [04-Feb-2008 12:42:59] Fetching: http://www.mysite.com/simpleinvoices/./images/logo/_default_blank_logo.png
    [04-Feb-2008 12:42:59] Status code:200
    [04-Feb-2008 12:43:00] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77 bytes) in /home/mysite/public_html/simpleinvoices/pdf/css.border.inc.php on line 200


    When I look at my folders - there is no invoices folder

  • lvanderblvanderb February 2008

    Hi,

    Just ignore that last line - I'm really not sure what the problem is!

    I do have those files, they are returning a 200 code.

    Thanks,
    Linda

  • justinjustin February 2008

    Hey Linda,

    probably best to ask Bluehost.com

    they may have some special php.ini setup or something

    let us know how you go

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • arzajacarzajac February 2008

    I am having the same trouble.

    My memory limit is set to 32M

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 72 bytes) in /home/***/public_html/invoices/include/pdf/css.margin.inc.php on line 9

    I upgraded successfully to the newest version but I still have the same problem.

  • arzajacarzajac February 2008

    I increased the memory limit by adding an edited php.ini file to the invoices directory, and phpinfo reveals that the memory is indeed 64M, but I still get the same error.

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77 bytes)

  • justinjustin February 2008

    Hey Arzajac

    One thing you can try is to set the values in .htaccess if possible

    you can override the default php.ini setting using .htaccess

    also may want to check all the memory values in http://yourinstall.com/simpleinvoices/phpinfo.php to ensure there all OK

    http://us3.php.net/manual/en/function.ini-set.php#80210

    if all else fails ask your host - maybe there are doing some funky thing that overrides your mods to php.ini

    let us know how you go

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • arzajacarzajac February 2008

    [quote=justin]

    also may want to check all the memory values in http://yourinstall.com/simpleinvoices/phpinfo.php to ensure there all OK


    I have increased it to 64M. I confirmed that with phpinfo from invoices. I still get the same error (reporting the same problem with 33554432 bytes exhausted) Since you said that 32M should be more than enough, I wonder what the problem would be.

    [quote=justin]
    if all else fails ask your host - maybe there are doing some funky thing that overrides your mods to php.ini



    I asked them, and am waiting for an answer. Do you have any possible idea what the problem could be related to? This trouble appeared all of a sudden. It may be that they upgraded php or changed some settings...

  • justinjustin February 2008

    Hey Arzajac,

    not really sure, i normally use on 24MB and it works fine - so 32 should work - but who know - your host may have made some changes

    was pdf working before?

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • arzajacarzajac February 2008

    [quote=justin]


    was pdf working before?


    Yes, perfectly fine.

  • justinjustin February 2008

    if it was working fine and you changed nothing then most likely the webhost did something

    one thing to try is to do a fresh install of Simple Invoices in a new directory

    cheers

    justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • arzajacarzajac February 2008

    I got it working.

    My hosting provider mentioned that a php.ini must be present in every subdirectory that requires setting different than the "master" (global) settings. The default memory setting is 32M. I upped the memory to 64M in the /include/pdf subfolder and I got it to work.

    Interestingly, the previous settings for php were 24M and everything worked fine then. Perhaps there have been point releases of PHP5 which make some things consume more ram(?)

    I experimented and found that I could not generate a pdf with anything less than 35 Megs of ram allocated in the /include/pdf subfolder. All other folders have a limit of 32M.

    Please let me know if there is anything else I can tell you about this issue.

    Thanks!

    Andrew

  • justinjustin February 2008

    Thanks Andrew

    good to hear its working now!

    i'll try using different memory levels on my PC and see how i go -might have to update the docs about this one

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • flatloopflatloop March 2008

    [quote=justin]
    you can override the default php.ini setting using .htaccess


    I'm having the same problem and would like a little more info on how to accomplish this in a more explicit information. I don't know really anything useful about PHP but I can follow the directions of those that do.

  • justinjustin March 2008

    hey flatloop

    ive never used .htaccess to set php.ini setting but believe its possible

    basically add a .htaccess file in your Simple Invoices directory

    then you can add the php.ini memory setting in there

    ie. memory_limit = 64M

    or php memory_limit = 64M

    don't know the exact syntax but it'll be something like above

    anyone else know the correct way to set php.ini settings via .htaccess?

    refer: http://us2.php.net/configuration.changes for more info

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • elghaielghai March 2008

    Hey folks

    I also got the same error. For me the solution was to set the memory limit to 256!! I'm using XAMPP with php 5.2.5

  • justinjustin March 2008

    256, damn thats alot!!

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • lvanderblvanderb April 2008

    Thanks Andrew, adding a php.ini file into my include/pdf/ folder did the trick for generating pdf files. Woohoo!

    Happy again :)
    Linda

  • justinjustin April 2008

    Hey Linda,

    great to hear its working now!!

    Thanks again Andrew!

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • CichawodaCichawoda July 2011

    Had the same problem but solved it by adding: ini_set('memory_limit','72M'); to the top of the index.php file. Still got the error at 64M but 72M did the trick.

  • jacquedonaldjacquedonald January 2012

    Cichawoda, I just used your trick on the first line of index.php (after the comments) and it worked perfect (i just had to set mine at 256M it failed at 72 then 128 so i just went to 256 and it worked like a champ!) Thanks!

  • rednectarrednectar February 2012

    Adding: ini_set('memory_limit','256M'); to the top of index.php worked for me too. Thanks for the help to all of you who contributed. Maybe this line should go in the default install.

  • modirmodir February 2012

    @rednectar With the new version we will have a new PDF library. Then we will need a lot less memory and the problem is gone.

  • gulz91gulz91 July 2012

    I have read the whole post and apply all the things but still i am getting Fatal errors.

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /home2/itutilis/public_html/tiger/library/pdf/css.state.class.php on line 99

    i have this in php.ini file ( memory_limit=1024M ) still doesn't work.
    In index file i have following code below.

    ini_set('memory_limit','1024M');
    <?php<br />
    $host = $_SERVER['HTTP_HOST'];

    preg_match("#^(.*)/[^/]*$#", $_SERVER['REQUEST_URI'], $matches);
    $uri = $matches[1];

    header("Location: http://${host}${uri}/demo/index.php");

    ?>

    Can some one please help me solve this question. thanks

Categories