"You were unable to login. Please check your cookie settings."

Started by Wolpo, April 16, 2025, 10:52:38 PM

Previous topic - Next topic

Wolpo

Hi,

I just moved my forum (SMF 2.1.4) to a new host. It's in a non-public test phase. I changed all forum related URLs and directories etc. in Settings.php. I used repair_settings.php and upgrade.php successfully. I checked all forum related URLs and directories in the MySQL database in phpMyAdmin. The forum looks normal. The forum messages are there, the members, the avatars etc. all looks fine.

But I can't log in with my existing two accounts as an admin and as a user. Nicks and passwords are correct. When the first step of the login is done, I'm promptly off and get this message:

"You were unable to login. Please check your cookie settings."

So I deleted my cookie. The problem is still there. I tried another browser that definitely has no remaining hidden cookie. No success.

I've read other threads here about this error message. But their stories are different and their solutions don't work for me.

Any tips? Thank you!

Sir Osis of Liver

You may have a http/https or www/non-www issue.  Try putting this in .htaccess in forum root -


# 301 REDIRECT HTTP TO HTTPS AND WWW TO NON-WWW
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
</IfModule>

When in Emor, do as the Snamors.
                              - D. Lister

Wolpo

Thank you.

I have no SSL yet.

I tried your htaccess text, but got an error as expected. So I changed the text to this:

# 301 REDIRECT HTTP TO HTTPS AND WWW TO NON-WWW
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,NE,R=301]
</IfModule>

Is the semantic correct?

I tried that, but I still can't login.

I just noticed that the forum does not look normal: All messages and accounts that were created after the year 2022 are gone. How can that happen? There was no error messsage during database export and import.


Edit:

I checked my database in phpMyAdmin. The latest data is included. The nickname of a guy that registered yesterday is in the database that I exported and imported today. But the latest messages in the test forum are from 2022.

In phpMyAdmin in some fields I also noticed these warnings:

"Warning: #1300 Invalid utf8mb3 character string:"

Could there be any problem with utf8 etc.?

Sir Osis of Liver

Link to forum?

Sounds like you only have a partial database.  Do you have a complete backup from old host?  New host should give you a free SSL certificate, most do.  Then you'll need to change all paths to https with repair_settings.  Have to fix the database first.

When in Emor, do as the Snamors.
                              - D. Lister

Wolpo

I edited my last message while you posted your new message.

I just checked my database in phpMyAdmin. The latest data is included. The nickname of a guy that registered yesterday is in the database that I exported and imported today.

So my database is complete. Also the file size is about the same as that of my backups in the past few months.

I'll get the SSL when I transfer the domain. The current test forum site is not public yet.



In phpMyAdmin in some fields I also noticed these warnings:

"Warning: #1300 Invalid utf8mb3 character string:"

Could there be any problem with utf8 etc.?

Sir Osis of Liver

Default collation for 2.1.4 is utf8mb3_general_ci.  Did you upgrade the forum before migration, or move it as is?  Which php version is running on new host?  Which language are you using?

You can have a look at this.
When in Emor, do as the Snamors.
                              - D. Lister

Wolpo

I didn't upgrade the forum before migration. I moved it as is.

On the new site, "upgrade.php" made some changes in the database. In the past 10 years I updated my SMF from time to time. I never did this with a full install but always with an update patch or something like that. So maybe the old database kept certain things from a very old SMF version?

On my old and new host I use php 8.1.

Could that utf8 thing garble my login strings?

Wolpo

In phpMyAdmin I just checked my encoded password string under "passw". It's pretty long and contains $ signs and dot signs. Other encoded password strings are shorter and contain just numbers and lower case letters.

Could it be that my password is garbled in the database due to a "utf8" transfer problem?

Wolpo

I found this message in another thread from 2021:

https://www.simplemachines.org/community/index.php?topic=577080.msg4086859#msg4086859

Quote from: dungeonseeker on April 18, 2021, 11:10:13 AMOK, so after doing another reinstall I worked out that I need to make 2 changes to the database for login to work...

I must change globalCookies to 0 then manualy add localCookies and set it to 1.

Can someone tell me how I can find "globalCookies" and "localCookies" in my database in phpMyAdmin?

(I'm new to phpMyAdmin. I know the "Structure" tab and the edit field at the top named "Containing the word:". And I know the "Search" tab where I can search for words. On neither tab I find "globalCookies" nor "localCookies". I guess I'm using the wrong tabs for that.)

Wolpo

Here's another thread from 2023:

https://www.simplemachines.org/community/index.php?topic=584843.msg4144218#msg4144218

Quote from: manudevil on January 27, 2023, 11:27:40 AMHere are my settings about cookies:

Quote"variable"    "value"
"cookieTime"    "60"
"globalcookies"    "0"
"httponlyCookies"    "1"
"localcookies"    "1"
"samesiteCookies"    "lax"
"secureCookies"    "1"

Manudevil's problem was solved in that other thread ("disable secure cookies").

Can anyone tell me where I can find these cookie settings?


Also interesting: "globalCookiesDomain" -- where can I find that one?

Got it from this thread: https://www.simplemachines.org/community/index.php?topic=579012.0

Wolpo

Here's another hint:

My URL of my test forum has this structure (names are fictitious):

h t t p : / / anySubDirectory.12345.myNewHost(dot)com/smfBoard/index.php

Could that "subdirectory" thing kill the cookie system?

It's the only way to test the forum before I move my domain with the auth-code.

Kindred

wait wait wait....

You said that you moved the forum, corrected all of the settings, and did the upgrade...


 but then you ALSO said that you took a copy of your production database and imported it.


You can't do that.
The upgrade process CHANGES significant parts of the database. a 2.0.x database WILL NOT WORK with a 2.1.x forum. period....   If you import the 2.0.x database into your 2.1.x forum, you will need to run upgrade.php AGAIN....   *AND* you will need to run repair_settings.php AGAIN, because the paths and urls stored in the database will be wrong.



Сл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."

Wolpo

I think I ran it twice because it didn't work in the first run. Anyway, thank you, I will run it again just to be sure.

(Some years ago, on my old website, I upgraded my forum software to version 2.1. I thought this upgraded the related DB as well during the upgrade process. Does it not?)

Anyway, I will re-run the stuff as you said.
Do I have to re-upload all files from the "smf_2-1-4_upgrade" folder?
Or should I re-upload just those files whose file names start with "upgrade*.*"? (The ones which were auto-deleted after the upgrade process.)

Sir Osis of Liver

Upgrade.php upgrades the database from earlier versions to 2.1.4.  If you've already uploaded 2.1.4 files from upgrade package, you only need to upload upgrade files to run upgrade again on database.

When in Emor, do as the Snamors.
                              - D. Lister

Wolpo

Thank you. I just did that.

Now when I run upgrade.php I get a "500 Internal Server Error".
When I run index.php the forum loads OK (no 500 error). I just can't log in and the DB doesn't show data created after 2022.


Quote from: Kindred on April 17, 2025, 01:52:37 PMYou said that you moved the forum, corrected all of the settings, and did the upgrade...

 but then you ALSO said that you took a copy of your production database and imported it.

We may have a misunderstanding here. Sorry, if my comment was unclear.

My very first steps yesterday were these:

1. Imported my old DB in phpMyAdmin on the new test site.
2. Copied my old 2.1.4 forum folder to the new test site.
3. Edited settings.php for the test site.
4. Checked the test forum. Didn't work as expected.
5. Ran repair_settings.php and entered all recommendations.
6. Checked the test forum. Didn't work as expected.
7. Uploaded all files from smf_2-1-4_upgrade.
8. Ran upgrade.php -- but it stopped at the beginning due to a wrong avatar path (it was an old path that repair_settings didn't correct).
9. Ran phpMyAdmin and replaced all remaining old paths in the DB with the correct test site paths.
10. Re-ran upgrade.php -- this time it completed the process successfully and auto-deleted the upgrade*.* files.
11. Checked the test forum. It loaded OK. But I can't log in. Also, the DB just shows those member accounts and posts which were created between 2009 (forum start) and 2022, although the data after 2022 exists in phpMyAdmin.




Sir Osis of Liver

Did you update domain nameservers to point to new host?
When in Emor, do as the Snamors.
                              - D. Lister

Wolpo

Now I'm running repair_settings.php and the repair page appears without the 500 error.

But ... the repair page is cropped at the bottom after "Attachment Directory:"

I refresh the browser but the repair page just won't appear completely. The scroll bar ends at the bottom.

Wolpo

Quote from: Sir Osis of Liver on April 17, 2025, 06:55:04 PMDid you update domain nameservers to point to new host?

Not sure what you mean ...

I haven't moved my domain yet.

Sir Osis of Liver

500 is a server error, there should be something in server error log.
When in Emor, do as the Snamors.
                              - D. Lister

Sir Osis of Liver

If you've moved the forum files and database to a new host, you must update the nameservers for the domain.  You don't have to move the domain, but it must point to new host.  It's in domain settings wherever your domain is hosted.  If it's still pointing to old host bad things will happen.

When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: