You are not logged in.

#1 2025-11-20 17:17:04

walmartshopper
Member
Registered: 2010-03-31
Posts: 39

php 8.4.15 SQLSTATE[HY000] [2002] Failed to parse IPv6 address

After upgrading from php 8.4.14 to 8.4.15 yesterday, my IPv6 DB connection no longer works.

When trying to establish a PDO connection to a mariadb server using an IPv6 address, I get the error:

SQLSTATE[HY000] [2002] Failed to parse IPv6 address "[::1]"

The connection worked fine on php 8.4.14.  I don't see anything in the php 8.4.15 changelog that would cause this, so I'm wondering if this build is missing IPv6 support or something.  I also tried other non-localhost IPv6 addresses and get the same error.

Sample code:

$conn = new PDO(
      "mysql:host=[::1];charset=utf8mb4",
      $username,
      $password
    );

Offline

#2 2025-11-20 21:19:59

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,424

Re: php 8.4.15 SQLSTATE[HY000] [2002] Failed to parse IPv6 address

do you have the below lines in your /etc/hosts ?

# The following lines are desirable for IPv6 capable hosts
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

If not, does it help if you add them ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2025-11-21 18:15:41

walmartshopper
Member
Registered: 2010-03-31
Posts: 39

Re: php 8.4.15 SQLSTATE[HY000] [2002] Failed to parse IPv6 address

I did not have those lines, but adding them and restarting php-fpm.service did not help.

Offline

#4 2025-11-21 18:30:09

loqs
Member
Registered: 2014-03-06
Posts: 18,671

Re: php 8.4.15 SQLSTATE[HY000] [2002] Failed to parse IPv6 address

Offline

Board footer

Powered by FluxBB