Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Fatal error: ...silverstripe-cache/cache.php on line 4

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1 2
Go to End
Author Topic: 13634 Views
  • plomar
    Avatar
    6 Posts

    Fatal error: ...silverstripe-cache/cache.php on line 4 Link to this post

    Hi,

    sometime when i run my site it show me this error message:
    Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 7864320 bytes) in /home/golftarc/public_html/silverstripe-cache/cache.php on line 4
    and when i refresh it, works normally.
    my site : http://www.golf-tar.com/
    i think my server memory limit is set to 48M
    Resource Limits: memory_limit: Maximum amount of memory a script may consume (8MB): 48M

    What can i do?

    P.S. i have the latest version of SS

  • darkowl
    Avatar
    Community Member
    12 Posts

    Re: Fatal error: ...silverstripe-cache/cache.php on line 4 Link to this post

    I've just deployed a SS install wrapped up from my development server onto a MediaTemple GS service.

    I also get this same nonsense - but it's infrequent. Sometimes it happens, sometimes it is just fine. Memory leaks? Strange version conflicts?

    I have no idea. Same error though - line 4 of cache.php, which I believe is an auto-generated file?

    Edit: Just inspected the cache.php file. It's gone completely berserk with the $browsers=array(...); line and $userAgents = array(...); line and just filled them repeatedly with arrays of information. Absolute madness! What could be causing this? It seems /sapphire/misc/Browscap.php is to blame... but why? Maybe it's to do with that file being so huge and full of dead browsers that it takes way too much processing power to parse into an array effectively?

    I'm just excising useless browsers to see if reducing the file size makes any difference.

    Hey, wow. That helps IMMENSELY. Page loads are insanely quicker. I guess there's a *massive* overhead in parsing that file (it's too huge!!!) and it just chokes PHP up when the server is under load. What the heck is this ridiculous thing anyway? Why do we need the world's most overly complex browser detection, again?

    Edit again: Well, it works okay for pages, but if you do a ?flush=1 on anything it still chokes on the cache.php file. Hmm...

    Edit once again: Oh right. Replaced the browscap.ini in the cache directory with my own, lighter version and then deleted the cache.php file and rebuilt. Now it's a mere 4kb instead of over 400kb. Joy. Rebuilds now work without issue, and pages are nice and fast. Excellent.

  • Nicolaas
    Avatar
    Forum Moderator
    213 Posts

    Re: Fatal error: ...silverstripe-cache/cache.php on line 4 Link to this post

    Hi

    I have the same problem. Really annoying because it means that any new person accessing the site gets an error.

    I am now following your instructions and see if that helps.

    Cheers

    Nicolaas

  • Andy
    Avatar
    230 Posts

    Re: Fatal error: ...silverstripe-cache/cache.php on line 4 Link to this post

    I've just replaced the browscap.ini with a lighter version (see http://browsers.garykeith.com/downloads.asp), which has reduced the size of cache.php to 262k. As this is just used for site statistics, we probably don't need the huge amount of bots listed there, so I'm certain we can take this down much further as you have done.

  • Doug Avery
    Avatar
    9 Posts

    Re: Fatal error: ...silverstripe-cache/cache.php on line 4 Link to this post

    Thanks for updating us on this! I've been having the same problem sporadically since I installed the latest build. Since there's no good way of testing it, I guess I'll just install the new browscap and wait to see if errors persist.

  • OzziNL
    Avatar
    Community Member
    37 Posts

    Re: Fatal error: ...silverstripe-cache/cache.php on line 4 Link to this post

    I put a "this page loaded in xx seconds" on my page and did want was mentioned above:

    before 0.15 seconds (av.)
    after 0.9 seconds (av.)

    I used the light version of browscap.ini for the test (196k)

    Cheers,
    Ozzi

  • froburg
    Avatar
    Community Member
    8 Posts

    Re: Fatal error: ...silverstripe-cache/cache.php on line 4 Link to this post

    I'm having the same problem. I replaced browscap.ini with the smaller version (I assume I'm getting the one that says light_php_browscap.ini - I renamed it to browscap.ini and swapped it for the one in sapphire/misc/), but I can't figure out where cache.php is. When I load my site (http://www.stayingconnectedyork.org/?flush=1) it gives me the path to cache.php (/tmp/silverstripe-cache-home2-stayingc-public_html/cache.php), but that file doesn't exist - there's no silverstripe-cache-home2-stayingc-public_html directory in /tmp. How do I find/erase cache.php?

    Anyone?

  • darkowl
    Avatar
    Community Member
    12 Posts

    Re: Fatal error: ...silverstripe-cache/cache.php on line 4 Link to this post

    If you have a silverstripe-cache/ folder it will be in there, otherwise it will be in the default tmp location (wherever that may be).

    I still don't understand the point of having the browscap in there... statistics should really be an optional module

    There seems to be a few things in Silverstripe that seemed like a "good idea", which are affecting performance quite significantly. This is one, and that manifest type thing (which makes a several hundred KB PHP file full of arrays) is another.

    Incidentally, I use the browscap that I've attached, which I hand-gutted, leaving in things that were crawler or "bad" only. It's way smaller than the "light" browscap.ini provided. 48kb is much better than a few hundred, eh?

    EDIT: Hmm, it seems that the upload function doesn't work? Or is disabled? Well, anyway, if anyone wants it let me know, and I can post it up on one of those file-distribution things like SendSpace.

    13634 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.