News:

Join the Facebook Fan Page.

Main Menu

Error

Started by ATVL, August 06, 2018, 03:51:57 PM

Previous topic - Next topic

ATVL

Hi,

I am not sure if this is the right forum to post this in, but I was wondering if anybody had any advice/pointers about an error we are getting on our Crossroads forum located at crossroadsnetwork.co.uk/newsmf [nofollow]

It was returning a HTTP 500 error, but we contacted our host who advised us of this problem:

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /home/crossr/public_html/newsmf/Sources/Load.php on line 742

which is now showing on the url as well. Unfortunately, the host wasn't able to help further as it's a software issue. 

I am not an expert at all of this, so do let me know if I have missed out any information that might be needed to offer advice.

Thanks
Lynn

Looking

Did you recently install / uninstall a mod?

Shambles

Please download & attach your Load.php

Please also declare your SMF and PHP versions

Arantor

FYI it's PHP 5.6.36, and an SMF 1.1.x installation. Can't really give you more information than that without the OP responding.

ATVL

Hi

Not that I'm aware of re modifications,

I have attached the load.php file.

Thanks guys for the replies so far.

Arantor

OK, so that's really weird. There's literally a random line of code missing in the middle of the file just before line 742.

One think I can also say, your forum was already out of date and had multiple security issues even putting this aside. While I can fix the missing code on its own, I'm wary of doing that until we can work out what the plan for upgrading is - because 1.1.x is now not getting any updates (and that file suggests you're several years behind on those as it is...)

Shambles

There are bits of your file missing.

// Get the general permissions.
$request = db_query("
SELECT permission, addDeny
FROM {$db_prefix}permissions
????????????
$removals = array();


What version of SMF and did you make any recent changes?


EDIT: Ok, best to not have two people firing here.

ATVL

Hi,

I am fine with upgrading if it can be done with keeping the posts/members etc.

Yes it does make sense that it is quite old. The forum was last active around 2015/2016. We are now trying to bring it back online. Because it was last active a fair bit ago, I can't be too sure about what exactly caused these errors.

I would appreciate any help re the missing code/upgrading etc.

Thanks
Lynn

Arantor

You can keep all the posts and members without any problems - if in doubt take a backup first through your hosting panel.

This wiki article talks about how to do the upgrade: Upgrading SMF

Note that you will need to find a new theme and possibly replace and mods/addons you had.

ATVL

Will upgrading fix the code issue Arantor? Sorry if I sound a bit clueless, this really isn't my forte. I'm just a bit braver at poking around the hosting than the other admin.

Arantor

Yes, it will - during the upgrade, you upload a complete set of new files to replace all the old ones.

ATVL

Thanks Arantor. Doing it now. It has taken a while as I am doing it via cpanel > file upload.

I am just waiting on Packages > Installed.list the file upload has hung on 72%, is this normal?

Gary

You don't run the upgrade through the package manager. You have to extract the files onto your PC, then upload them overwriting the existing files in FTP.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

ATVL

I have managed to restore the forum but cannot see the posts/topics/members etc, thinking that all of that might be lost unfortunately. It was down for quite a while with other admins attempting to restore it in that time, so I cannot account for what anybody else has done, but it looks like the original forum has been wiped.

Thanks anyway guys for all of your help.

Arantor

No, it looks like you ran a new install rather than the upgrade. This should actually be fixable by uploading the upgrade package rather than the install one, and fixing the database connection by making a new DB user (unfortunately I need to go to bed now but others may be able to talk you through it)

ATVL

Hi Arantor,

You're right that I did inadvertently originally download as a new install but then I realised this error and did add upgrade.php from the upgrade download as well.

Would appreciate any help from you or others in remedying the situation, if still possible.

GigaWatt

1) Did you make a backup of your old forum's files and database?

2) Did you overwrite the original files with the ones from the upgrade package?

3) If both answers to the previous questions are yes, did you run the "upgrade.php" file (yourforumurl.com/upgrade.php)?
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Sir Osis of Liver

IIRC, if you ran install.php on your production database you've removed all your content and reverted to a scratch install.  Do you have a db backup?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Quote from: Sir Osis of Liver on August 06, 2018, 10:03:49 PM
IIRC, if you ran install.php on your production database you've removed all your content and reverted to a scratch install.  Do you have a db backup?


It should have created a new database because it should warn you if you give it DB details pointing at an existing DB.

ATVL

Hi guys

I didn't run install.php as I tried to run upgrade.php as when nothing happened I realised my mistake when re-reading the wiki upgrade page, so I then downloaded the upgrade zip and placed upgrade.php into the folder of the install download, but i guess that isn't the only difference between the two downloads?

Anyway, the newsmf database looks very small to me, like 0.28mb?? too small to contain what was once an active forum I think you can see the working forum here http://web.archive.org/web/20140416114922/www.crossroadsnetwork.co.uk/newsmf [nofollow] 

As I said other people have attempted to bring the forum back online over the last couple of years and may have possibly done something to the database. I think that is more likely than me doing a fresh install, as I certainly wasn't forewarned of any db conflicts.

However, I have found in a folder titled 'back ups' on the server a 'crossr_newsmf.sql' file that is 447MB, do you think that might be it? and if so, can it be used to restore in any way?

GigaWatt

Quote from: ATVL on August 07, 2018, 06:15:17 AM
However, I have found in a folder titled 'back ups' on the server a 'crossr_newsmf.sql' file that is 447MB, do you think that might be it? and if so, can it be used to restore in any way?

Yes, that is probably a database backup. Create a new database, upload that dump in the new database (you may want to use zip when uploading the backup in the database, just make sure you end the file name with .sql.zip, the actual file name of the archive doesn't matter as long as it's the same as the name of the file, i.e. backup), upload the previous version of the files (1.1.x) via FTP (set in binary mode, not auto or ASCII mode), make sure it's working (i.e. reachable on the web), than download the large upgrade pack, extract the content and upload the content of the archive in the same directory where the previous version of the forum exists. It will ask you if you would like to overwrite files, answer "yes for all". After you've uploaded all of the files from the large upgrade pack, run "upgrade.php" (forumurl.com/upgrade.php).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Arantor

I did get a PM about this where it was revealed that the backup is apparently too old a format to be uploaded.

That's certainly fixable and likely just requires fixing all the TYPE= declarations to ENGINE=, doing that on a 400MB file is not trivial :(

ATVL

Hi,

I have been advised this by the host

the current MySQL version is 10.1.31-MariaDB and the backup which you have generated is of the old version. Hence, the database syntax doesn't match.

is that fixable guys?

Arantor

Of course it is, as per the post just above yours... but it's not simple because there aren't many editors that can actually handle a 400MB file.

ATVL

What are my options? If I can find an editor, then what am I looking for/to do? Really appreciate the help you have been giving me Arantor and Gigawatt, and everyone else who has replied of course.

Shambles

To be honest it'd probably be easier to just create a script to do this one-off job.

I just unzipped one of my backups into a 430Mb sql file and created a new file with the pattern changed, as advised by Arantor:


<?php
if(!$fh fopen('backup.sql','r')) die('input file failed');
if(!
$fo fopen('sqlnew.sql','w')) die('output file failed');
while (
$line fgets($fh)) {
  
$changeTo '/ENGINE=MyISAM/';
  
$changeFrom '/TYPE=MyISAM/';
  
fwrite($fo,preg_replace($pattern,$convto,$line));
}
fclose($fh);
fclose($fo);
?>


It took 20 seconds to run on my home server.

ATVL

Hi Sh@mbles,

Thank you for your response,
I'm afraid that just sounds like jargon to me though, as I am no expert with this stuff. :s If I uploaded the db file somewhere, would someone be able to help?

Shambles

Sure. Upload it somewhere, send me the link. I'll edit it and send you a replacement download link.

Shambles

For anyone following this, the sql dump provided has proven to be worthless.

The importer fails due to a syntax check while importing the SMF_LOG_ERRORS table, as that's where the dump stops. Looks like it was probably taken through the Admin panel rather than via "mysqldump".

The ENGINE=MyISAM declarations of the tables that did make it through are intact, however only the following tables appear in the sql dump:

CREATE TABLE `smf_attachments` (
CREATE TABLE `smf_ban_groups` (
CREATE TABLE `smf_ban_items` (
CREATE TABLE `smf_board_permissions` (
CREATE TABLE `smf_boards` (
CREATE TABLE `smf_calendar` (
CREATE TABLE `smf_calendar_holidays` (
CREATE TABLE `smf_categories` (
CREATE TABLE `smf_collapsed_categories` (
CREATE TABLE `smf_log_actions` (
CREATE TABLE `smf_log_activity` (
CREATE TABLE `smf_log_banned` (
CREATE TABLE `smf_log_boards` (
CREATE TABLE `smf_log_errors` (


Sorry chap, you may as well discard that sql dump file.

ATVL

Thanks anyway for your help Sh@mbles.  :)

Shambles

If you come across any other potential .sql dump files, let us know and we'll have a look at them.

Shambles

If you DO discover further dumps and wondering if they're suitable, download a large file explorer such as glogg which does a great job of viewing big data.

Sir Osis of Liver

You can load a large sql file into Wordpad, and do a find/replace to fix it.  Assuming, of course, you have a complete dump.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Since when will Wordpad handle 400MB?

Sir Osis of Liver

Just loaded a 320mb sql (takes a while), pretty sure it will do 440mb.  Can't find anything between 320mb and couple gb, rather not push my luck.

It choked on 827mb. :P
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Kindred

Ugh. Never use word pad for anything.

Notepad++ or ultraedit
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

I've been coding with wordpad (xp version) for as long as I've been here, works fine.  Use a macro to bump up the font size/face so I can read it (bad eyes), it backs out a lot of changes if needed, saves clean as plain text.  Notepad++ is too busy for me, even after cleaning up the interface.  Only use it when I need line count or to compare files.  Never tried ultraedit, maybe give it a look.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Gary

Quote from: Sir Osis of Liver on August 07, 2018, 07:47:47 PM
I've been coding with wordpad (xp version) for as long as I've been here, works fine.  Use a macro to bump up the font size/face so I can read it (bad eyes), it backs out a lot of changes if needed, saves clean as plain text.  Notepad++ is too busy for me, even after cleaning up the interface.  Only use it when I need line count or to compare files.  Never tried ultraedit, maybe give it a look.
You're probably mistaking Wordpad for Notepad, they're two separate things. ;)
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

Sir Osis of Liver

I know what they are, been using windows since 3.1, dos before that.  Wordpad is fine for coding, long as you remember to save as plain text.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

landyvlad

I know this is tangential to the thread OP but while wordpad and notepad will both 'do the job' for coding, they are not optimized for it my any means.

notepad++ leaves them for dead.

Linux users - notepadqq is what you want.
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Arantor

Eh, I abandoned Notepad++ a long time ago.

I wouldn't trust Wordpad in any form, even if saving as plain text because it can easily screw up encoding. Even UTF-8 can be mangled by it. The fact it even loads 400MB is news because it's always crashed at under 100MB for me...

Sir Osis of Liver

Never had a code problem with wordpad, maybe because I'm still using the xp version.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Also you never had to deal with an encoding problem, I think.

Sir Osis of Liver

Probably right, but as long as it works, I'll use it, until it doesn't.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

By which time it's already too late...

Advertisement: