Jump to content

[Resolved] Site down - 500 error


bobdonkey

Recommended Posts

Hi, my whole site is down, admin works but I can't get to any of the normal pages, www.barebonesuk.com

It started acting oddly, some pages were not showing all the products, then some pages individually had 500 errors, and now the whole thing won't load.

The errors in the System error log are like this (more of them)

Exception] /home/ngnkyuwv/public_html/barebonesuk.com/includes/lib/smarty/sysplugins/smarty_internal_template.php:163 - Unable to load template 'file:templates/content.homepage.php'
    Today, 15:09    

[Exception] /home/ngnkyuwv/public_html/barebonesuk.com/includes/lib/smarty/sysplugins/smarty_internal_template.php:163 - Unable to load template 'file:templates/box.basket.php'

 

I switched the skin back to foundation and it has not helped.

Help!

Thanks

Link to comment
Share on other sites

I think 644 as these are files that are simply read in, not executed. But 755 actually grants more permissions than are necessary.

 

If this just started happening, then we blame your hosting provider.

On an unlikely scenario, it could be that CubeCart is telling Smarty to use a skin that isn't there, but CubeCart thinks it is.

Oh, but you said you switched to Foundation, so a missing skin folder is probably not the reason.

Link to comment
Share on other sites

I set them all to 644 and has not helped. Also checked error_log on the server and nothing in there.

I think it may have something to do with skins, as I recently updated my skin (last week), it seemed to have a few issues and I switched back to an older version today, and then all hell has broken loose and wont even work with foundation now.

Admin site works fine however. 

Link to comment
Share on other sites

I wasn't asking about changing the Admin skin, which very few people do. Just trying to verify that a step was not missed.

When you say you changed to using Foundation skin for the storefront - did you change the setting in Admin>Store Settings>Layout from your messed up skin to Foundation?

1 hour ago, bobdonkey said:

I guess I can just delete the site and reinstall using the same database?

Someone else more knowledgeable needs to confirm that this will not cause other issues. Installing on top of what you now have might work, but once something is messed up I'm hesitant to make suggestions. I don't trust myself to not make your situation worse.

Link to comment
Share on other sites

That's all I need - a bit of moral support. I really need to pay for some support but since I am not making anything yet and paying an accountant I just dont have the spare. So these forums are a bit of a lifesaver.

I think it is going to be a long night!

Link to comment
Share on other sites

OK I just found that the error_log file was in fact huge, and there are loads of errors like this:

 

[04-Feb-2017 23:45:47 UTC] PHP Fatal error:  Allowed memory size of 14680064 bytes exhausted (tried to allocate 200 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 146
[04-Feb-2017 23:46:48 UTC] PHP Fatal error:  Allowed memory size of 94371840 bytes exhausted (tried to allocate 20000 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101
 

No idea why this has started happening, anyone seen this before?

Link to comment
Share on other sites

The GD class is what creates the re-sized images from the source and puts them in the /images/cache/.

Your allowed memory size of 14,680,064 and 94,371,840 (why this is 'allowed' and not 'remaining', I don't know) suggests your account is allocated (or PHP is configured to use) 128MB of memory.

Normally, this is plenty. Very plenty. Huge plenty.

Except when the GD library is wanting to load an image file that, when decompressed, is in the multi-megabyte working memory size.

So, using FTP (or Cpanel), look in /images/source/ for image files that are greater than 350KB in size. In admin, unset that image from being associated with the product(s), then have the FileManager delete that image. That image will disappear from the folder, so be sure to have a copy located elsewhere.

Using an external image editing application, resize the image so that it is no larger than 800 pixels on its longest side and 350KB in filesize. Then have FileManager upload it back into CubeCart.

This is the first I have seen an apparent connection between Smarty not able to load a template and PHP complaining it ran out of memory. Maybe there is no connection, but you need to get your image sizes under control.

I will be surprised if stopping PHP from running out of memory fixes Smarty saying it cannot load a template.

Link to comment
Share on other sites

Hi 

Thanks for that.

Yes I figured out this was the problem as well, I deleted every image from all products and got the site back.I do have several thousand products, and all of them have several images. I also have my own scripts that upload them which is why I can go over 350kb, but they generally aren't over 1mb. I added 100 product images back and it fell over again. It puts some images in cache and then stops. 

14680064 bytes is only 14mb, this doesnt seem like much. Is there any way to increase it? Or is there a problem with my host? I appreciate by images are a little over sized but I can't resize thousands of images manually.

[05-Feb-2017 07:37:17 UTC] PHP Fatal error:  Allowed memory size of 14680064 bytes exhausted (tried to allocate 2400 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 146
[05-Feb-2017 07:41:54 UTC] PHP Fatal error:  Allowed memory size of 14680064 bytes exhausted (tried to allocate 600 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 146
[05-Feb-2017 07:43:45 UTC] PHP Fatal error:  Allowed memory size of 14680064 bytes exhausted (tried to allocate 4000 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101
[05-Feb-2017 07:43:49 UTC] PHP Fatal error:  Allowed memory size of 14680064 bytes exhausted (tried to allocate 800 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 146
[05-Feb-2017 07:46:00 UTC] PHP Fatal error:  Allowed memory size of 14680064 bytes exhausted (tried to allocate 4000 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101
[05-Feb-2017 07:47:18 UTC] PHP Fatal error:  Allowed memory size of 14680064 bytes exhausted (tried to allocate 4000 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101
[05-Feb-2017 07:47:34 UTC] PHP Fatal error:  Allowed memory size of 28311552 bytes exhausted (tried to allocate 2400 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101
[05-Feb-2017 07:50:27 UTC] PHP Fatal error:  Allowed memory size of 28311552 bytes exhausted (tried to allocate 9600 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101
[05-Feb-2017 07:51:36 UTC] PHP Fatal error:  Allowed memory size of 28311552 bytes exhausted (tried to allocate 9600 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101
[05-Feb-2017 07:51:46 UTC] PHP Fatal error:  Allowed memory size of 11534336 bytes exhausted (tried to allocate 2360 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101
[05-Feb-2017 07:52:54 UTC] PHP Fatal error:  Allowed memory size of 11534336 bytes exhausted (tried to allocate 2360 bytes) in /home/ngnkyuwv/public_html/barebonesuk.com/classes/gd.class.php on line 101

Link to comment
Share on other sites

14 MB is very tiny even by the standards of some of the stingy hosting companies out there these days !  Check the values for local and master memory_limit under php info option.  It is very unlikely that you will be able to change the value as the hosting companies keep these values low so they can put more websites on each server

Ian

Link to comment
Share on other sites

I am convinced that the error message is actually reporting how much memory you have remaining available (as opposed to total configured) when PHP wants to allocate just a tad more (600 bytes or 9600 bytes) than what remains available.

CubeCart will show memory usage in its debug section: Peak Used vs Max Configured

 

Link to comment
Share on other sites

PHP docs say:

Quote

This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.

However, your host may have wrapped your account in Suhosin which has its own limits applied.

For example, a HavenSwift hosting account says PHP has 512MB, but "suhosin.memory_limit" has 256MB.

If your account is wrapped in Suhosin, you might find a "suhosin" table in PHP Info.

Link to comment
Share on other sites

1 hour ago, bsmither said:

For example, a Havenswift hosting account says PHP has 512MB, but "suhosin.memory_limit" has 256MB.

You are correct that suhosin, if installed, has additional settings and some that over ride standard php settings.  The settings for memory that we are talking about here are generally set at the same value - on that server where you have recently opened an account, there was indeed a mismatch (although the correct setting of 256 MB would still be available) and that has been corrected.

Link to comment
Share on other sites

OK contacted by host, it seems I have 512MB physical memory allocated and I am hitting that limit. Site is hosted with Pac web hosting https://www.pacwebhosting.co.uk and they are using cpanel.

This is what they said:

The value -1 means that there is no limit for PHP . But when I have checked your site I can see the problem is not in the virtual memory but the physical memory which is limited on our side and you have indeed reached the limit.

Do you think I need another host? 512MB doesnt seem like much to me!

Link to comment
Share on other sites

I would argue that for the modest needs of the CubeCart codebase, 512MB is plenty.

It is the edge cases, such as your need for very high dimension/filesize images, that justify going for a higher level of hosting account resources.

With a little bit of work, you can make your own skin-specific, appropriately sized and named derivations of the source image and FTP those to the /image/cache/ directory.

Link to comment
Share on other sites

If the 512 MB was a PHP limit, then that is per process and 512MB is very big for a shared hosting company (most offer 32 MB or maybe up to 64 MB or at a push 128 MB) but they have said they dont limit that (-1 value).  However, they have additional limits per account, so that would be a total of 512 MB of RAM available for ALL processes - get a few customers on your site and then you doing a memory intensive operation like loading and processing large images, then that will very quickly be reached !!

Ian 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...