Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: MargeKinson on July 28, 2020, 01:14:02 PM

Title: Syntax Error
Post by: MargeKinson on July 28, 2020, 01:14:02 PM
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



Title: Re: Syntax Error
Post by: Shambles on July 28, 2020, 01:18:03 PM
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.
Title: Re: Syntax Error
Post by: Arantor on July 28, 2020, 01:29:33 PM
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.
Title: Re: Syntax Error
Post by: MargeKinson on July 28, 2020, 01:40:23 PM
Thank you both for your quick response.

I'll do that now Arantor. :) It worked, thank you for the advice.
Title: Re: Syntax Error
Post by: Arantor on July 28, 2020, 01:44:44 PM
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.
Title: Re: Syntax Error
Post by: MargeKinson on July 28, 2020, 01:57:10 PM
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.
Title: Re: Syntax Error
Post by: Arantor on July 28, 2020, 02:02:48 PM
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.
Title: Re: Syntax Error
Post by: MargeKinson on July 28, 2020, 02:28:07 PM
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.
Title: Re: Syntax Error
Post by: 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.
Title: Re: Syntax Error
Post by: Arantor on July 28, 2020, 06:13:17 PM
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.
Title: Re: Syntax Error
Post by: Sir Osis of Liver on July 28, 2020, 06:53:00 PM
<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.
Title: Re: Syntax Error
Post by: Illori on July 28, 2020, 07:29:59 PM
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.
Title: Re: Syntax Error
Post by: Sir Osis of Liver on July 28, 2020, 07:39:44 PM
Couldn't this have been as easily fixed in one of the 2.0 patches?  It's been a known problem for a while.
Title: Re: Syntax Error
Post by: Arantor on July 29, 2020, 02:17:43 AM
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.
Title: Re: Syntax Error
Post by: Sir Osis of Liver on July 29, 2020, 12:41:04 PM
Wasn't being reductive, just asking a question.  Thanks for the explanation.
Title: Re: Syntax Error
Post by: Arantor on July 29, 2020, 12:42:29 PM
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.
Title: Re: Syntax Error
Post by: MargeKinson on July 29, 2020, 07:11:07 PM
I'd prefer to find a permanent fix for something given the choice. :D Still, I appreciate everyone's input, thank you.
Title: Re: Syntax Error
Post by: Arantor on July 29, 2020, 07:23:14 PM
The solution I provided will fix the problem for you. It won't fix the problem for everyone.
Title: Re: Syntax Error
Post by: MargeKinson on July 29, 2020, 08:22:37 PM
Thank you again for your assistance.