Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

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

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

Fatal error: ...silverstripe-cache/cache.php on line 4

Go to End

14 Posts   14984 Views


6 Posts

10 December 2007 at 5:43am

Edited: 10/12/2007 5:44am


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 :
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


Community Member, 12 Posts

10 December 2007 at 4:33pm

Edited: 10/12/2007 5:10pm

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.


Forum Moderator, 224 Posts

10 January 2008 at 12:58am


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.




Community Member, 231 Posts

10 January 2008 at 2:51pm

I've just replaced the browscap.ini with a lighter version (see, 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

9 Posts

10 January 2008 at 4:11pm

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.


Community Member, 37 Posts

11 January 2008 at 4:27am

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)



Community Member, 8 Posts

17 January 2008 at 10:05am

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 ( 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?



Community Member, 12 Posts

17 January 2008 at 11:26am

Edited: 17/01/2008 11:28am

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.

Go to Top