News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Migrated from HG server to SH server. Big Problems!

Started by Big Gee, May 31, 2018, 12:19:27 PM

Previous topic - Next topic

GigaWatt

#20
Quote from: Kindred on June 02, 2018, 01:38:11 AM
Also, the default theme directory is used for all template files which are not specifically defined/customized by other themes.

In short...   he did something that he should never have done, and, in the process completely broke the system

That's why I wrote that it's a failsafe ;). It contains everything that any other theme doesn't have to contain ;).

@Big Gee: Currently, the other site (https://jacothenorth.net/NewParty/MembersForum/) is locked (requires a username and a password to log into), so I can't really see what's going on. In any case, if you haven't applied the login fix for 2.0.15, you have to do it manually (since you can't log in the forum).

1) Download index.template.php from the default theme's (Curve) directory (your_forums_root/Themes/default/). You can do this either by FTP/SFTP or your host's file manager, your choice.

2) Open up index.template.php in Notepad++ (you can download it here). Find this code in index.template.php.

Code (index.template.php) Select
<input type="hidden" name="hash_passwrd" value="" />

If you have other code trailing behind the one above, you probably have the 2.0.15 fix implemented. It should look like this.

Code (index.template.php) Select
<input type="hidden" name="hash_passwrd" value="" /><input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />

Or possibly, like this.

Code (index.template.php) Select
<input type="hidden" name="hash_passwrd" value="" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />


In case you don't have the trailing code, you should add it, which means that if you've only got the code in the first snippet present in index.template.php, you should change it like in the last code snippet.

3) Backup the original (unmodified) index.template.php. You could just change the name of the file, let's say to index.template.php.no.2.0.15.fix.

4) Upload the modified index.template.php file in your_forums_root/Themes/default/.

5) Try loading your forum via it's URL in your browser. If things are messed up with your current theme, load the forum with the default theme (Curve) with this URL.

http://yourforumsurl.com/index.php?theme=1;action=login

If the above doesn't work, try this URL.

http://yourforumsurl.com/index.php?theme=default;action=login

If neither of these work, change the theme to the default one via repair_settings.php.



After you've clicked on Save Settings, reload repair_settings.php in the address bar (Ctrl + F5), Set SMF Default theme as overall forum default for all users should be set to Yes (recommended if you have problems).

Try loading your forum again (yourforumsurl.com), the default theme (Curve) should appear. If you're still having problems loading the forum, try hitting Ctrl + F5 in your browser. Afterwards, try logging in. The fix should be applied and you should be able to log in.

6) Apply the same login fix on your theme's index.template.php. There may be 2 places from which you can login on your theme (the quick login and the regular login). You have to apply the fix in both places, otherwise, you'll only be able to login from one of them.

Hope this helps ;).
"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?"..."

Big Gee

OK I've followed yor instructions. Downloaded the original as a backup. Went to edit the file from the default theme directory, on doing a search in Notepad++ I discovered that the line of coding was identical to the second example you showed GigaWatt. So I left it as it was.

Incidentally, the version is 2.0.14. There is only one theme loaded - the default one, so there are no complications with other installed themes.

Here is the existing line of coding in the index.remplate.php

<input type="hidden" name="hash_passwrd" value="" /><input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />

Tried loading the login page via the two URL addresses you suggested. The result is exactly the same. On entering the username & password I get this message:



Where do I go from here? I can temporarily remove the user name/password from the site's directory on the server. It won't make much difference as no one can log-in anyway. You can then see for yourself what is happening. Shall I do that? You can then try registering an account, so that you can try and log in yourself.

Thanks,

G.

GigaWatt

Quote from: Big Gee on June 02, 2018, 03:42:20 PM
Where do I go from here? I can temporarily remove the user name/password from the site's directory on the server. It won't make much difference as no one can log-in anyway. You can then see for yourself what is happening. Shall I do that? You can then try registering an account, so that you can try and log in yourself.

Yes, that's preferable, so that we can all (not just me) see what's going on ;).

Unlock it, well go from there ;).

EDIT:

Quote from: Big Gee on June 02, 2018, 03:42:20 PM
<input type="hidden" name="hash_passwrd" value="" /><input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />

Try changing the code from that to this.

<input type="hidden" name="hash_passwrd" value="" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />


Just add another new line between <input type="hidden" name="hash_passwrd" value="" /> and <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
"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?"..."

Big Gee


GigaWatt

I can't register. The captcha is not working, OK, I worked around that with the sound captcha (although, that is also not working, but I managed to get the wave file)... and I hit a white screen :S. This means a server side error. What version of PHP are you using on this URL? If it's 7.x, change it to 5.6.

Have you got a lot of mods installed? It doesn't look like you've got any installed. In this case, it would be simpler to just use the large upgrade package and install all of the files from scratch, use repair_settings.php to fix everything and just load logo, images, etc.
"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?"..."

Big Gee

I downgraded the PHP version on the server to 5+ something from 7+, when we were trying to get the other SMF site to work. The server is still running on PHP v 5 at present.

The only thing I can think of is some file corruption in the migration process took place. I don't think any mods have been installed/ changed from the original install.

It's SMF v 2.0.14 so it's not that far out of date and surely should work on PHP v 7+? It was only downloaded and installed less than six months ago. So what exactly do you suggest GigaWatt? That I download the 'large upgrade package' as you call it & then what? Does it automatically install over the existing installation? In fact I've never done an upgrade on an SMF installation before, so I'm not familiar with the process.

Talking of the other SMF site (Gardeners Chat Shed) that is a v 2.0.1 or something similar. Will that start to play up when I restore the server to run PHP 7 again?

Any pointers would be helpful. Also I'd love to know - out of curiosity - what caused it to fail in the first place, because it was working fine on the previous server. The main difference now is that it's on a later version of MySQL, a newer version of PHP and now has SSL activated.

Thanks,

G.

Sir Osis of Liver

SMF 2.0.14 requires php 5.4 or higher, and supports 7.0 and (iirc) 7.1, but will have problems in 7.2.  Some mods will not work correctly in php 7, and SMF 2.0.1 does not support php 7.  Best bet is to run everything in php 5.6.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Big Gee

If I did a clean install of SMF (v 2.0.15) and associated it with the existing MySQL DB that's currently associated with the present site (gardenerschat-shed.net/forum) which is a SMF v 2.0.1. Then deleted the old site - would the new site run with all the information that's currently on the old site's DB do you think? Or would there be some compatibility issues? Because if I brought both sites up to scratch (version wise) I could then use PHP 7 again on the server.

Thanks,

G.

Sir Osis of Liver

You're currently running 2.0.10, not 2.0.1, but yes, the database will work in 2.0.15 if you upgrade the forum.  It's not necessary to run upgrade.php, just upload the files, there weren't any database changes from .10 to .15.  You can also patch from 2.0.10 to 2.0.15 in package manager, but that won't clean up your install.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Illori

take a look at https://wiki.simplemachines.org/smf/How_to_upload_a_fresh_set_of_files

you need to remember to remove the hooks then reinstall the mods after you are done.

GigaWatt

#30
Quote from: Big Gee on June 02, 2018, 06:18:31 PM
The only thing I can think of is some file corruption in the migration process took place. I don't think any mods have been installed/ changed from the original install.

Did you upload the files via FTP? If so, did you set the client in ASCII, Binary or Auto Mode? If you ran it in ASCII mode, this sort of thing can happen and I've accidentally done it on my forum. Actually, I tried all of the files to have CR+LF (Windows style) line endings and I f*ed up the forum (had similar errors as the one you posted, on this forum), but an FTP program set to transfer in ASCII instead of binary mode can produce the same problem. You might also have problems with corrupted attachments, so make sure that you always set your FTP program to transfer in binary mode, not ASCII or Auto mode.

Quote from: Big Gee on June 02, 2018, 06:18:31 PM
So what exactly do you suggest GigaWatt? That I download the 'large upgrade package' as you call it & then what? Does it automatically install over the existing installation? In fact I've never done an upgrade on an SMF installation before, so I'm not familiar with the process.

First, let's establish if you've got any mods (modifications) installed in your current version (2.0.14). If there are none, you can proceed with the following.

1) Download the large upgrade package.

2) Delete everything from your current forum root directory, except the attachments directory. The only thing you can delete from the attachments directory is .htaccess and index.php.

3) Extract the content of the zip archive (the large upgrade package) in a folder (any will do) and transfer the files via FTP in the root of the forum, just make sure you set the FTP program to transfer in binary mode, not ASCII mode. Either that, or you could just drop the archive in your forum's root directory and extract the files via your host's file manager. This option is preferred (but I already wrote the text for the first option, since my host's file manager sucks and I use FTP all the time, so... :P :D).

4) Run upgrade.php (yourforumurl.com/upgrade.php), that should take care of any database inconsistencies between 2.0.14 and 2.0.15.

5) Don't load the forum in your web browser just yet. Upload repair_settings.php in the root of the forum and run it (yourforumurl.com/repair_settings.php). See if there are any inconsistencies and correct them. Also, don't forget to set the default theme (Curve) for all users. With the default theme, the forum will load without any problems. You can set your preferences later, one at a time ;).

6) If you think you've got everything set up correctly in repair_settings.php, try opening your forum in your web browser. No matter what the browser displays, hit Ctrl + F5 and see if it displays the same thing again. If everything seems OK from a graphical perspective (theme loads properly), try logging in. If you can log in successfully, you've solved your problem ;).

Sill not working: If something doesn't load or if you get a white screen with some text about "something missing", "can't connect to database", something is misconfigured (paths, URLs or database credentials). Run repair_settings.php again and go through all of the settings in detail, see if what the tool reports as a preferred value is actually set as a value in the adequate fields (clicking on the value will automatically load it in the adequate field). In most cases, the repair_settings.php tool will detect the adequate values that are supposed to be loaded (without the database settings of course, it can't detect that, especially not the database name, user and password, you have to enter them yourself), but in some cases, it can't or the detected values will be wrong. In those rare cases, you'll have to ask for support from your host.

If you have any modifications installed, keep in mind that all of them will be removed with the upgrade procedure. That's why I wrote what I wrote at the beginning. You'll have to reinstall all of them (if they are compatible with 2.0.15).

EDIT: And another thing about mods (modifications) that use hooks.

Quote from: SMF WikiIf you are using SMF 2.0 and had mods installed you may want to use Fix_Packages.php to remove the hooks that the mods installed. This is a good idea if you see some mods are still installed when browsing the admin panel after uploading clean files.

Quote from: Big Gee on June 02, 2018, 06:18:31 PM
Talking of the other SMF site (Gardeners Chat Shed) that is a v 2.0.1 or something similar. Will that start to play up when I restore the server to run PHP 7 again?

Yes. The current stable version of SMF, 2.0.15 does work with PHP 7.0 and 7.1 (I have my forum running on 7.1), but I think that 7.x support was added in 2.0.14 (someone correct me if I'm wrong). 2.0.1 definitely has no 7.x support. And definitely don't set the version of PHP to 7.2. This will throw a lot of "depreciate function" errors. PHP 7.0 or 7.1 is a safe bet after you've upgrade to 2.0.15. If for some reason, things don't work as they are supposed to on PHP 7.x, downgrade to 5.6, everything should be back to normal ;).

Quote from: Big Gee on June 02, 2018, 06:18:31 PM
Any pointers would be helpful. Also I'd love to know - out of curiosity - what caused it to fail in the first place, because it was working fine on the previous server. The main difference now is that it's on a later version of MySQL, a newer version of PHP and now has SSL activated.

That question answers itself... basically, everything's different. It's like moving into a new house that is nothing like your old one. It's a lot bigger (that's a plus, but your wife hates big houses, since she now has a lot more cleaning to do, and she can't stop nagging about it, so... when you look at it from a different perspective, it's not a plus), it's further away from the city (also a plus... if you you've got the budget for the extra fuel you'll need for the car, but let's say you don't... which means that you'll have to get a new job and start in a new working environment, which is always a little stressful, and you'll probably be more busy, not have enough free time, so... again, what seemed like a plus, is, once again, a minus) and on top of that, you'd have to go through a magic forest to get there (this is a minus from the start... except when you're into RPG :D).

I think you get the point ;).

You might not have ran into problems with your gardening forum (forgive me if I'm mistaken about the interest of discussion) since it's running SMF 2.0.14, which has support for PHP 7.0 and 7.1, but the other one is on 2.0.1 which definitely doesn't work on PHP 7.0 or 7.1.

So, if you can only set the PHP version for the whole webspace, not for a paticular domain (for example, on my host I can set PHP version per domain and subdomain), until you have things sorted out with the SMF 2.0.1 forum, I'd stick with PHP 5.6 ;).

Quote from: Illori on June 02, 2018, 06:50:13 PM
you need to remember to remove the hooks then reinstall the mods after you are done.

If you've got mods installed, removing hooks is a must... found out the hard way ::).
"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?"..."

Illori

Quote2) Delete everything from your current forum root directory, except the attachments directory. The only thing you can delete from the attachments directory is .htaccess and index.php.

you should NOT delete those 2 files in the attachments folder, they are there for security and NEED to be there.

Quote4) Run upgrade.php (yourforumurl.com/upgrade.php), that should take care of any database inconsistencies between 2.0.14 and 2.0.15.
you dont need this step as there are no database changes since SMF 2.0 was released

you are also missing out on the step to remove hooks, this has been provided in the link i linked already. this is why we try to use the wiki as a reference so we dont tell people the wrong steps.

GigaWatt

Quote from: Illori on June 03, 2018, 06:08:45 AM
you should NOT delete those 2 files in the attachments folder, they are there for security and NEED to be there.

I know, but they will be extracted from the archive of the large upgrade package ;).

Quote from: Illori on June 03, 2018, 06:08:45 AM
you dont need this step as there are no database changes since SMF 2.0 was released

I didn't know if there were any, that's why I wrote that ;). It's good to know that there aren't any... well, at least not between 2.0.14 and 2.0.15.

Quote from: Illori on June 03, 2018, 06:08:45 AM
you are also missing out on the step to remove hooks, this has been provided in the link i linked already. this is why we try to use the wiki as a reference so we dont tell people the wrong steps.

OK, I'll try to use it in the future ;).

EDIT: I edited my post and quoted the part about Fix_Packages.php from the SMF Wiki about uploading a fresh set of files ;).
"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?"..."

Big Gee

Fantastic guys - especially your guide GigaWatt. I'm sorry I haven't responded sooner - I've been out of circulation today - a rare day off!
I'll do a DB backup before I start in earnest tomorrow.

I discovered that my FTP client (FileZilla) is actually set to auto - which was a bad start, it's been changed now. Although the FTPing of the sites from the old server was carried out by my hosting company - Smart Hosting in the UK. They've been priceless with their support with this - thanks to their excellent support we've finally managed to transfer all the sites that were hosted with Hostgator, for whom I have nothing good to say unfortunately - I'll just leave it at that - NOT recommended, although I was with them for nearly 15 years. I'll find out tomorrow if the FTP transfers were in fact originally done with 'auto' or ASCII by Smart Hosting. The only two sites that were broken were the two SMF sites that I've been referring to on here. So I suspect there was a common cause associated with bringing those two sites over. All the others, using Opencart, Cubecart and Word Press were OK - excepting a few minor hiccups involving SSL.

SO you recommend I delete ALL the files currently in the server side directory of the SMF site GigaWatt? With the exception of 'Attachments'. Then upload all the files from the extracted 'large upgrade' package in Binary Mode. Then run the 'repair_settings.php file from the browser. Fingers crossed then.

I'll report back as soon as I'm done. After the 2.0.14 to 15 upgrade - if it's successful - I'll do exactly the same with the site running 2.0.10 by upgrading it to to 2.015. I've already downloaded the two large upgrade packages.

Once again MANY THANKS to you all for your input into this problem.

G.

GigaWatt

Quote from: Big Gee on June 03, 2018, 04:24:05 PM
SO you recommend I delete ALL the files currently in the server side directory of the SMF site GigaWatt? With the exception of 'Attachments'. Then upload all the files from the extracted 'large upgrade' package in Binary Mode. Then run the 'repair_settings.php file from the browser. Fingers crossed then.

Yes, that about covers it. If you've got a backup of the attachments (attachments directory) and you're not sure in what mode you did the FTP transfer, upload them again via FTP but make sure it's set in binary mode. The attachment files have no file extension, so some FTP programs can treat them as text files and change line endings (they think they are doing you a favor ::)), which can lead to file corruption (read some of the problems I've ran into in this thread). Afterwards, upload the extracted files from the large upgrade package (SMF 2.0.15) archive (also via FTP). If the FTP client reports that some files have the same name and destination (most likely .htaccess and index.php in attachments dir), choose overwrite all.

And don't change the name of the attachments dir (or any file or dir for that matter) from attachments to Attachments. Linux/UNIX servers are case sensitive when it comes to file names and directory names (not like Windows where attachments and Attachments is the same).

Quote from: Big Gee on June 03, 2018, 04:24:05 PM
Once again MANY THANKS to you all for your input into this problem.

No problem ;).
"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?"..."

Kindred

do not delete Settings.php, Settings_bak.php or ANY .htaccess files....

Seriously, leave the attachments and the avatars directories alone.

Delete files in the root (except for the ones listed above) delete the Sources and the Themes directories and subdirectories. Leave everything else.
Сл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."

shawnb61

#36
The files you want to keep are the ones potentially referenced within your site:

   - /attachments folder(s) possibly more than 1
   - /avatars folder
   - /Smileys folder (in case you have custom smileys installed/referenced...)
   - Custom avatars folder, if configured  (This is a user set value...  Found under avatars settings, under 'upload to'...   Another way to look this up is to look in your settings table, & see if there is a value set for 'custom_avatar_dir' & 'custom_avatar_url'...   This is often /avs, as the documentation for configuring this in 2.0.x specifies /avs as an example...)
   - any directories that support installed mods, e.g., /downloads
   - Settings.php
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Big Gee

Thank you very much.

Just one more query, before I start on the work. This site actually needs to me moved to a different domain on the same server. Rather than execute the 'large upgrade' on the directory that the site is currently on, can you see any problem copying the folders left, (after the rest of the files are deleted), to a folder on a different domain, and then uploading the extracted upgrade files to that new folder? Would that upset anything?

I'll wait to hear from you before I go any further.

All the best,

G.

Aleksi "Lex" Kilpinen

I would suggest doing the upgrade in place first, and making sure everything is OK and working before moving to a new location.
Then the move should be pretty straight forward, just copy files (and db if needed, depending on the server config) to a new location, and run repair_settings.
( If your DB settings change, you may need to run repair_settings twice. First to save new DB info, then again to fix all the rest of the settings. )
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Big Gee

OK - that makes sense Lex.

I'll try and get it on it's feet where it is, and then copy the files to a new directory on a different domain and then I'll run the 'repair_settings' tool.

Sounds like a plan to me!

I'll report back what the results are.

Thank you very much,

G.

Advertisement: