Anyone can comment on a bug. Have a simpler test case? Does it
work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please
— but make sure to vote on the bug!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

[2019-01-17 19:44 UTC] php at darkain dot com

Changing listen to "0.0.0.0:9000" will properly listen on IPv4 without IPv6 as expected. Manually specifying an IP address (either v4 or v6) works as expected as well. It is only when specifying port ONLY that it is broken according to the docs.

[2019-01-22 17:27 UTC] laszlo at karolyi dot hu

+1, Same as #77501.
Adding the information here that listening on both interfaces is only available with specifying two separate fpm configurations, with the respective listen directives.

Looking at the fpm_socket.c code and the comments in it I can see that some incorrect assumptions are being made.
The current code is performing the following steps to bind to the TCP socket:
-------
/* Bind ANYADDR
*
* Try "::" first as that covers IPv6 ANYADDR and mapped IPv4 ANYADDR
* silencing warnings since failure is an option
*
* If that fails (because AF_INET6 is unsupported) retry with 0.0.0.0
*/
-------
As far is I know IPv4 mapped addresses are disabled by default in FreeBSD, also if IPv6 support is enabled in the kernel (which is enabled by default in GENERIC kernel) than there always be at least one IPv6 interface - it is lo0 (localhost). That leads to the AF_INET6 is reported as being supported and the code will not fail to bind to IPv6 ANYADDR. So there would be no attempt to bind to IPv4 ANYADDR.

[2019-01-25 07:31 UTC] ard_1 at mail dot ru

This bug should also hit OpenBSD users since as far as I know there is no support for IPv4 mapped addresses exist in OpenBSD at all.
Also if I'm getting the root cause of this problem right, setting sysctl net.ipv6.bindv6only=1 in Linux should perform a similar effect and PHP-FPM would not bind to IPv4 ANYADDR too.

[2019-01-25 08:11 UTC] ard_1 at mail dot ru

This non-portable socket binding behavior was brought with the attempt to fix bug https://bugs.php.net/bug.php?id=74166 and a corresponding commit.
As far as I know, the portable way to fix this bug is possible by creating two independent sockets. PHP-FPM should bind to IPv6 socket with setsockopt() to turn on the IPV6_V6ONLY option. And then it should try to bind an IPv4 socket to the same port on 0.0.0.0