Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Holt31 on July 23, 2017, 01:42:22 PM

Title: Database Error when connecting with IPv6
Post by: Holt31 on July 23, 2017, 01:42:22 PM
Hello guys,
if I try to use SMF 2.0.1.4 with Nginx (nginx/1.10.3) and php7.0-fpm I get a strange error when connecting with IPv6 to the forum site.
I'm using Mysql (5.7.18-0ubuntu0.17.04.1) on a dedicated server from Hetzner. I'm using Ubuntu 17.04 as server os.
So the problem is when someone joins with the domain (nox-gaming.de) on that forum they are getting Database Errors on every site.
I tryed it with a brand new installation of smf 2.0.1.4 with no mods installed to make sure that no mod is providing the database error.
So this is my Nginx config for the server:


server {
listen 80 default_server;
#listen [::]:80 default_server;
server_name nox-gaming.de www.nox-gaming.de;
return 301 https://$server_name$request_uri;
}

# SSL
server {
    listen 443 ssl http2;
    #listen [::]:443 ssl http2;

    root /***/***/***;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name nox-gaming.de www.nox-gaming.de;

ssl_certificate /***/***/***/***.cer;
ssl_certificate_key /***/***/***/***.key;
   
location / {
try_files $uri $uri/ /index.php?$args;
}

# PHP-7
location ~ \.php$ {
#If a file isn't found, 404
try_files $uri =404;
#Include Nginx's fastcgi configuration
include /etc/nginx/fastcgi.conf;
#Look for the FastCGI Process Manager at this location
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

# Phpmyadmin Configurations
location /***/***/***/phpmyadmin {
   root /usr/share/;
   index index.php index.html index.htm;
   location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
   root /usr/share/;
   }
   }
# URL Rewrite for Nginx PHPMyAdmin
   
   location /phpMyAdmin {
   rewrite ^/* /phpmyadmin last;
   }

# URL Rewrite for SMF
location /forum {
   if (!-e $request_filename) {
                # Rules for: profiles
                rewrite ^/forum/profile/([^/]+)/?$ "/forum/index.php?pretty;action=profile;user=$1" last;

                # Rules for: actions
                 rewrite ^/forum/(activate|admin|ads|announce|attachapprove|ban|boardrecount|buddy|calendar|clock)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(collapse|convertentities|coppa|credits|deletemsg|detailedversion|display|dlattach|editpoll|editpoll2)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(emailuser|featuresettings|findmember|groups|help|helpadmin|im|jseditor|jsmodify)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(jsoption|lock|lockvoting|login|login2|logout|manageboards|managecalendar|managesearch|manageattachments|maintain|markasread|mascot)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(membergroups|mergetopics|mlist|moderate|modifycat|modifykarma|movetopic|movetopic2|news|notify)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(notifyboard|optimizetables|openidreturn|packages|permissions|pm|post|postsettings|post2|printpage|profile|quotefast)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(quickmod|quickmod2|recent|regcenter|register|register2|reminder|removepoll|removetopic2)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(repairboards|reporttm|requestmembers|restoretopic|reports|search|search2|sendtopic|serversettings|smileys|smstats|suggest)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(spellcheck|splittopics|stats|sticky|theme|trackip|about:mozilla|about:unknown)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(unread|unreadreplies|verificationcode|viewErrorLog|viewmembers|viewprofile|vote|viewquery|viewsmfile|who)/?$ "/forum/index.php?pretty;action=$1" last;
                 rewrite ^/forum/(\.xml|xmlhttp)/?$ "/forum/index.php?pretty;action=$1" last;

                # Rules for: boards
                 rewrite ^/forum/([-_!~*'()$a-zA-Z0-9]+)/?$ "/forum/index.php?pretty;board=$1.0" last;
                 rewrite ^/forum/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ "/forum/index.php?pretty;board=$1.$2" last;

                # Rules for: topics
                 rewrite ^/forum/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ "/forum/index.php?pretty;board=$1;topic=$2.0" last;
                 rewrite ^/forum/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ "/forum/index.php?pretty;board=$1;topic=$2.$3" last;

                 rewrite ^/(.*)$ /index.php?params=$1 last;
}
   }
location ~ /\.ht {
        deny all;
    }
}


Even if I deactivate those rewrite rules, I have the same problem.
So if I deactive IPv6 in Nginx all is working fine.
But then the next problem happened: Some Firefox users can't join the site (also the normal website before smf).
I found out that they all are trying to join with IPv6.
I have an AAAA-Record on my Domain and also an A-Record. (I need it for mailserver)
Both IP-Addresses on the Domain are correctly entered.
My Mysql is running on localhost with IPv4.
Databasesettings are:
Host: localhost
Port: Standard
User: ***
PW: ***
No Nginx-Errorlogs where found.
No SMF-Errorlogs also.
Is it possible to let Nginx running with IPv6 without any Database-Error-Messages and a working page?
Because these users can join the site if I active IPv6. But than the forum isn't working anymore.
I put so much work into my SMF-Configuration. I don't won't to migrate my installed forum to another forum-system.
For me SMF is the best forum system out there. So I don't want to change.
The forum is reachable on nox-gaming.de/forum
Title: Re: Database Error when connecting with IPv6
Post by: vbgamer45 on July 23, 2017, 01:55:20 PM
What database error are you getting?
Title: Re: Database Error when connecting with IPv6
Post by: Holt31 on July 23, 2017, 02:46:00 PM
Just the message:
Database error: Try again or try to contact an administrator.
No errors in Admin-Panel and no errors in nginx and mysql-logs.
Title: Re: Database Error when connecting with IPv6
Post by: vbgamer45 on July 23, 2017, 03:25:07 PM
There is mod for SMF 2.0.x https://custom.simplemachines.org/mods/index.php?mod=3051

SMF 2.1 IPV6 is supported by default.
Title: Re: Database Error when connecting with IPv6
Post by: Holt31 on July 23, 2017, 03:34:47 PM
Yeah I have that mod installed.
The Problem is my Theme is not working anymore with SMF-2.1 also all mods I installed would be useless.
I know that SMF 2.0 is not supporting IPv6 but it is strange that you get a database error when connecting with IPv6 to the forum-site.
Title: Re: Database Error when connecting with IPv6
Post by: Holt31 on July 23, 2017, 04:15:06 PM
Ok a friend of mine tryed now with ipv6 again and now I get an error:
Databaseerror: Data too long for column 'session' at row 1
I will search the forum now for fixing this problem.
Title: Re: Database Error when connecting with IPv6
Post by: vbgamer45 on July 23, 2017, 04:42:44 PM
You can disable database driven settings under server settings
Or you can increase the session column size in the database for the smf_sessions table.
Title: Re: Database Error when connecting with IPv6
Post by: Holt31 on July 23, 2017, 09:28:30 PM
I increased the session column size before you told me. But thanks  :laugh:
So new problem is: Databaseerror: Incorrect string value: ''Someones IPv6-Addres here'' for function inet_aton
I can't find any usefull answer in forum.
Title: Re: Database Error when connecting with IPv6
Post by: vbgamer45 on July 23, 2017, 10:47:01 PM
Check out last post on this page
http://www.simplemachines.org/community/index.php?topic=545026.0
Title: Re: Database Error when connecting with IPv6
Post by: Holt31 on July 24, 2017, 11:17:14 AM
Done that already, same problem.
Title: Re: Database Error when connecting with IPv6
Post by: vbgamer45 on July 24, 2017, 12:12:08 PM
Does say a line or file number?

Also maybe turn off database driven sessions under server settings as well
Title: Re: Database Error when connecting with IPv6
Post by: Holt31 on July 24, 2017, 12:50:37 PM
I turned of database driven sessions already, but same problem.
I just get still this error. It's just that. I found out that inet_aton is a function in /Sources/Subs.php
But no line error and no file number as well.
It's creepy that we can't figure out why it's not working.
Title: Re: Database Error when connecting with IPv6
Post by: vivien on April 01, 2018, 02:47:17 AM
I have the same problem since switching to PHP 7 (SMF 2.0.15 with mod "IPv6 Support 1..1" installed)
Title: Re: Database Error when connecting with IPv6
Post by: GigaWatt on April 01, 2018, 08:38:03 AM
Which minor version?
Title: Re: Database Error when connecting with IPv6
Post by: vivien on April 02, 2018, 02:38:17 PM
SMF: 2.0.15
IPv6 Support: 1.0.1
PHP Version : PHP 7.0.28-0ubuntu0.16.04.1
MySQL : MySQL: 5.7.21-0ubuntu0.16.04.1
Apache : Apache/2.4.18 (Ubuntu) Server built: 2017-09-18T15:09:02
OS : Ubuntu server 16.04 LTS 64bits

With IPv6 :
Incorrect string value: ''2a01:cb08:768:xx00:600b:1bbd:5541:6de0'' for function inet_aton
Fichier: /forum/Sources/Subs.php
Ligne: 2675


All is ok with IPv4
Title: Re: Database Error when connecting with IPv6
Post by: vbgamer45 on April 05, 2018, 05:30:42 PM
SMF 2.0.x doesn't support IPv6 disable apache from listen on ipv6.
Title: Re: Database Error when connecting with IPv6
Post by: vivien on April 06, 2018, 09:57:36 AM
I use the mod "IPv6 support 1.0.1" for SMF 2.0.x : https://custom.simplemachines.org/mods/index.php?mod=3051
Title: Re: Database Error when connecting with IPv6
Post by: vbgamer45 on April 06, 2018, 12:48:32 PM
I would leave comments in that mods topic. They might not have fixed all cases like in your case.