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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

Problems with Sapphire > JSMin


Go to End


5 Posts   2985 Views

Avatar
Gringa

Community Member, 11 Posts

14 February 2009 at 10:08am

Help urgently needed. I am unable to log into the CMS.
Upon entering the user name and password, I received the following error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 24 bytes) in /home/[clientname]/public_html/sapphire/thirdparty/jsmin/JSMin.php on line 144.

I increased the hosting memory allocation, but this hasn't helped.
I deleted image files I had uploaded to the CMS, but this hasn't helped.

What is JSMin and how do I change the memory allocation?

Here is what is on line 144 in the JSMin.php file:

142  if ($c === null) {
143     if ($this->inputIndex < $this->inputLength) {
144     $c = $this->input[$this->inputIndex];
145     $this->inputIndex += 1;

Many thanks!

Avatar
Carbon Crayon

Community Member, 598 Posts

14 February 2009 at 1:54pm

Hi Gringa

This is from a lack of memory. When you say you upped it on your server are you sure it worked? if it did the memory size in the error would reflect that.
Try putting this at the top of your sapphire/main.php

ini_set('memory_limit', '64M');

that will force your memory to 64MB unless your host is limiting it to 32MB.

Avatar
Gringa

Community Member, 11 Posts

14 February 2009 at 2:24pm

Thank you for your reply!

I have not yet been able to get to the CMS admin area today.

I tried changing the JSMin file to 64M and the error message did reflect the changed size (the "24 bytes" in the error message increased). I then closed the admin and ran the dev/build (I'm running RC 2.3.0). Returning to the Admin led to an indefinite hang at the "SilverStripe is loading" stage.

I next changed the 64M to 45, thinking maybe the increased memory allocation to JSMin was causing the CMS to hog too much memory, though the same thing happened.

I changed the JSMin back to 64M and also now added "ini_set('memory_limit', '64M');" to the bottom of the main.php file in the Sapphire directory. Returning to the admin leads to another indefinite hang at the same "SilverStripe is loading" stage.

I'm at a loss.

On the hosting side of things, I'm running my own php.ini, set to 128M (instead of the default 32M). Checking my overall hosting limits, I'm only at 2% of my bandwidth and 1% of my allocated drive space.

Avatar
Carbon Crayon

Community Member, 598 Posts

14 February 2009 at 2:43pm

I would leave JSMin out of it, its just a generic memory error which happened to use up all the memory while running that script, I would set that back to how it was when you opened it and just concentrate on getting your memory allowance up to 64MB.

Put that line at the TOP of main.php, not the bottom. Also I guess ur custom php.ini is not working coz if you had 128M of memory you wouldn't be getting an error saying it ran out at 32M. And when I say the change would be reflected in the error I mean the other number, it would have something like 67554432 bytes (around 64MB) instead of the 32MB that you are currently getting.

Basically your problem is that SS cant access more than 32MB of memory. This has nothing to do with your storage and bandwidth allowances, its the RAM which is on the host machine. If you are on a shared host, it is very unlikely that they will allow you to go over 64M, so try setting that in your php.ini or just delete that line and let the main.php take care of it with the line I gave you in my previous post.

Avatar
Beck

Community Member, 23 Posts

4 August 2009 at 6:22pm

i solve this problem in this way:
1. i changed "memory_limit = 128M" in "php.ini"
2. then added "SetEnv PHPRC /*full_dir_patch*/php.ini" in "public_html/.htaccess" <-- it means that all php configuration from this file