Syntax Error

Started by MargeKinson, July 28, 2020, 01:14:02 PM

Previous topic - Next topic

MargeKinson

Hello!

My forum went down the other day, I had no idea why (this has never happened) but it seems there is a syntax error in the code (according to my hosting site). They recommend contacting the site developer to review the code and edit what is needed but there is no one to contact, I take care of the site even though my knowledge of code is limited. The other option I was given was to try restoring the site from a backup which I did but the site is still down.

I'm hoping someone will take pity on me and help me resolve this issue.  ;D

This is the info I have:

PHP Parse error:  syntax error, unexpected
''a:241:{s:14:"admin_features";' (T_ENCAPSED_AND_WHITESPACE) in
/home/marge_kinson/elfquestfanart.com/cache/data_2e43360d8f4b9b3727a5c75ab47ee766-SMF-modSettings.php
on line 1




Shambles

We've seen this before, especially with the cached copy of that file.

Empty the file cache using your admin panel, or just delete that file using your ftp client.

Arantor

You can't empty it from the admin panel, you can't get to the admin panel.

Best advice, upload the file it complains about here as an attachment, then delete it off your server.

MargeKinson

Thank you both for your quick response.

I'll do that now Arantor. :) It worked, thank you for the advice.

Arantor

So the file is exactly 8192 bytes, that's the symptom of the write bug we've seen before... but that in 2.0.17 only happens when the host server reports a file has been written successfully and didn't get written successfully :/

If it comes back, delete it again but there's not a lot we can do to help you out beyond that.

MargeKinson

Alright, thank you again for your assistance it was very much appreciated.

Hmm, there is a reported item in the gallery of my forum now and when I click to view the site shuts down again. Any way I can get rid of that or do I just have to keep deleting that file over and over to keep the site up?

Sorry, thought things would last longer than a minute and a half.

Arantor

Hrm, so did I.

Same file name or a different one in the logs?

If it's the same one, a targeted fix for just this one occurrence should be enough... Change Sources/Load.php:

Code (find) Select
if (($modSettings = cache_get_data('modSettings', 90)) == null)

Code (replace) Select
if (true)

The modSettings cache has always been a bit flaky, but you don't really want to turn all the caching off, just that one item.

MargeKinson

I can't seem to find it in the logs and it isn't showing up in the reported posts as it usually does when someone accidentally reports an item.

Sir Osis of Liver

Unless it's a very busy forum, disable caching in Admin -> Server Settings -> Caching.  Set it to 'No caching', then empty file cache, you won't notice any difference.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Quote from: Sir Osis of Liver on July 28, 2020, 05:47:05 PM
Unless it's a very busy forum, disable caching in Admin -> Server Settings -> Caching.  Set it to 'No caching', then empty file cache, you won't notice any difference.


As opposed to the fix I outlined that would solve the problem *and* keep the benefits of the rest of the caching :( Because on a lot of shared hosts, it matters.

But I guess that's the culture we're in now, we don't care to investigate the actual problem or, heaven forbid, actually try to solve it, just sweep it under the carpet, hope it never has any side effects.

Sir Osis of Liver

<sigh>  It's not about sweeping it anywhere.  It's about providing a simple, effective solution for forum users who may not know what you (or even I) know.  I've always had caching disabled on my own forums, and on many of the forums I support, and it's never caused a problem.  The proper fix is to fix the bug, but let's not go there.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Illori

but Arantor posted a good fix for this issue above. if needed a mod package could be made so users could apply the fix easily and keep their cache working. on some hosts you could get disabled due to high CPU usage due to no cache.

Sir Osis of Liver

Couldn't this have been as easily fixed in one of the 2.0 patches?  It's been a known problem for a while.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

No, actually, because doing that change on this site breaks *this p* site.

You see, not everyone is in the same place you are and caching modSettings is fine if it doesn't go above 8KB on a network share storage, or if it's not networked, or f you're using any of the other cache backends.

But sure, let's be reductive about it.

Sir Osis of Liver

Wasn't being reductive, just asking a question.  Thanks for the explanation.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Ah, but it is. Turning off as the *first* suggestion limits it ever being fixed (because, contrary to popular belief, it's not actually the same symptoms every time; sometimes it is Pretty URLs, sometimes it is networking, sometimes it is other bad mods), and the presumption of this fix being appropriate to every situation is also similarly reductive.

MargeKinson

I'd prefer to find a permanent fix for something given the choice. :D Still, I appreciate everyone's input, thank you.

Arantor

The solution I provided will fix the problem for you. It won't fix the problem for everyone.

MargeKinson

Thank you again for your assistance.

Advertisement: