PHP Mysql-API using IPv6

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Torsten Schmidt

    PHP Mysql-API using IPv6

    Hi,

    I'm trying to connect to a mysql-Server using PHP's mysql-function
    mysql_connect. The host on which the mysql-server is running is not the
    same as the host apache and php are running on. The two computers are
    connected in an IPv6-network.
    No matter if I give the hostname (defined in /etc/hosts), the
    IPv6-address ("fec0::4") or the IPv6-address in square brackets
    ("[fec0::4]") the function mysql_connect always prints "Unknown
    MYSQL-Server [servername]". Is it because of IPv6? Is PHP's mysql-API
    not capable of connecting via an IPv6-network? Unfortunately I didn't
    find anything about it in the documentation.
    I'm using PHP version 4.3.4. In case this version cannot handle
    IPv6-addresses, does anybody know whether PHP 5 beta can?

    Thank you for your help!

    Torsten
  • Daniel Tryba

    #2
    Re: PHP Mysql-API using IPv6

    Torsten Schmidt <giftwrapuk@yah oo.co.uk> wrote:[color=blue]
    > I'm trying to connect to a mysql-Server using PHP's mysql-function
    > mysql_connect. The host on which the mysql-server is running is not the
    > same as the host apache and php are running on. The two computers are
    > connected in an IPv6-network.[/color]

    Since when does mysql support ipv6?
    [color=blue]
    > Is it because of IPv6? Is PHP's mysql-API
    > not capable of connecting via an IPv6-network?[/color]

    Have you tried mysql's client instead of the buildin (which is really
    old code IIRC)?

    --

    Daniel Tryba

    Comment

    • Torsten Schmidt

      #3
      Re: PHP Mysql-API using IPv6

      Daniel Tryba wrote:[color=blue]
      > Torsten Schmidt <giftwrapuk@yah oo.co.uk> wrote:
      >[color=green]
      >>I'm trying to connect to a mysql-Server using PHP's mysql-function
      >>mysql_connect . The host on which the mysql-server is running is not the
      >>same as the host apache and php are running on. The two computers are
      >>connected in an IPv6-network.[/color][/color]
      [color=blue]
      > Since when does mysql support ipv6?
      > Have you tried mysql's client instead of the buildin (which is really
      > old code IIRC)?[/color]

      Yes I did. It doesn't work with mysql's client but I thought it's
      because the client is too old (I tried the mysql-client from the current
      debian-stable release which is version 3.23 and really old).

      But I don't know if MySQL Server does support IPv6. Does the server need
      to explicitly support it, too? That's a good point... If that's the
      reason for not working, is there another open source DB out there that
      does support IPv6?

      Torsten

      Comment

      • Chung Leong

        #4
        Re: PHP Mysql-API using IPv6

        Good question. I would think so, since the data structures passed to socket
        functions are different from those of IPv4.

        Uzytkownik "Torsten Schmidt" <giftwrapuk@yah oo.co.uk> napisal w wiadomosci
        news:bvisic$svj 87$1@uni-berlin.de...[color=blue]
        > But I don't know if MySQL Server does support IPv6. Does the server need
        > to explicitly support it, too? That's a good point... If that's the
        > reason for not working, is there another open source DB out there that
        > does support IPv6?
        >
        > Torsten[/color]


        Comment

        • Chung Leong

          #5
          Re: PHP Mysql-API using IPv6

          There must be some way though, to route an IPv4 address to an IPv6 address.
          You might want to try the TCP/IP newsgroup.

          Uzytkownik "Torsten Schmidt" <giftwrapuk@yah oo.co.uk> napisal w wiadomosci
          news:bvisic$svj 87$1@uni-berlin.de...[color=blue]
          > Yes I did. It doesn't work with mysql's client but I thought it's
          > because the client is too old (I tried the mysql-client from the current
          > debian-stable release which is version 3.23 and really old).
          >
          > But I don't know if MySQL Server does support IPv6. Does the server need
          > to explicitly support it, too? That's a good point... If that's the
          > reason for not working, is there another open source DB out there that
          > does support IPv6?
          >
          > Torsten[/color]


          Comment

          • Manuel Lemos

            #6
            Re: PHP Mysql-API using IPv6

            Hello,
            [color=blue]
            > Yes I did. It doesn't work with mysql's client but I thought it's
            > because the client is too old (I tried the mysql-client from the current
            > debian-stable release which is version 3.23 and really old).
            >
            > But I don't know if MySQL Server does support IPv6. Does the server need
            > to explicitly support it, too? That's a good point... If that's the
            > reason for not working, is there another open source DB out there that
            > does support IPv6?[/color]

            If you are using Unix/Linux and the Web server is in the same machine as
            the MySQL server, you should not be using TCP/IP at all. Instead you
            should use only Unix domain sockets. These are twice as fast as TCP
            sockets and obviously more secure as nobody can access your database
            from outside your server. In that case you should also start MySQL with
            the skip-networking option in your /etc/my.cnf file.
            --

            Regards,
            Manuel Lemos

            Free ready to use OOP components written in PHP


            MetaL - XML based meta-programming language

            Comment

            • Torsten Schmidt

              #7
              Re: PHP Mysql-API using IPv6

              There is actually, it is possible to tunnel IPv6 traffic via IPv4. But
              that wouldn't be of any use for my application.

              But Daniel was right - it's not PHP, it's mysql that doesn't support
              IPv6. I switched to PostgreSQL now and access that DB from PHP's
              postgresql-API works via IPv6! Thank you!

              Torsten

              Comment

              • Chung Leong

                #8
                Re: PHP Mysql-API using IPv6

                I mean the other way around, tunnel IPv4 traffic across an IPv6 network.

                Uzytkownik "Torsten Schmidt" <giftwrapuk@yah oo.co.uk> napisal w wiadomosci
                news:bvjsan$tbo 8q$1@uni-berlin.de...[color=blue]
                > There is actually, it is possible to tunnel IPv6 traffic via IPv4. But
                > that wouldn't be of any use for my application.
                >
                > But Daniel was right - it's not PHP, it's mysql that doesn't support
                > IPv6. I switched to PostgreSQL now and access that DB from PHP's
                > postgresql-API works via IPv6! Thank you!
                >
                > Torsten[/color]


                Comment

                Working...