[php-src] Issue #19987: Wont bind to IPv4 if IPv6 enabled
| From: | TheRealBecks | Date: | Mon, 29 Sep 2025 09:04:27 +0000 |
| Subject: | [php-src] Issue #19987: Wont bind to IPv4 if IPv6 enabled | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250926@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19987
Author: TheRealBecks
### Description
PHP-FPM can't listen to IPv4 and IPv6 simultaneously due to this old bug report from 2019: [Bug
#74166 IPv6 forced to be enabled](https://bugs.php.net/bug.php?id=74166)
The
listen parameter can be set for **all** IPv4 and IP6 addresses as follows:
### IPv4 only
**Configuration:**
```
[www]
listen = 0.0.0.0:9000
```
**Result:**
```
# podman exec -it test_testcontainer_phpfpm /bin/sh
/var/www/html # netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 1/php-fpm: master p
```
-> ✅ working as expected
### IPv6 only
**Configuration:**
```
[www]
listen = [::]:9000
```
**Result:**
```
# podman exec -it test_testcontainer_phpfpm /bin/sh
/var/www/html # netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::9000 :::* LISTEN 1/php-fpm: master p
```
-> ✅ working as expected
### IPv4 and IPv6
**Configuration:**
```
[www]
listen = 9000
```
**Result:**
```
# podman exec -it test_testcontainer_phpfpm /bin/sh
/var/www/html # netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::9000 :::* LISTEN 1/php-fpm: master p
```
-> ❌ IPv6 only, IPv4 is missing
I also tested two listen entries for IPv4 and IPv6, but the last listen
parameter seems to override the first one.
This also relates to #11593
### PHP Version
```plain
PHP 8.4.13 (cli) (built: Sep 25 2025 21:17:05) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.4.13, Copyright (c) Zend Technologies
with Zend OPcache v8.4.13, Copyright (c), by Zend Technologies
```
### Operating System
Official Docker container php:8.4.13-fpm-alpine3.22 with Podman instead of Docker