1

I have a very annoying problem with MAMP and all functions that try to connect to an external source.

I have a very simple fsockopen in my application.

$fp = fsockopen($this->port == 443 ? 'ssl://' . $this->host : $this->host, $this->port, $errno, $errstr, 20);

this is a lib given by our partner. Everything worked fined until the last MAMP or OSX Update i'm not sure.

That line produce the following error:

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

I've read a lot about that error and that error appears if the name isn't resolved. So i've made some other checks and the problem seems to be the ipv6 resolution. The site has no IPv6 DNS-Entry but the connection try to use IPv6 and there come that error and the connection is closed.

if i try the same on the command line:

ping6: getaddrinfo -- nodename nor servname provided, or not known

i get the same error. So why isn't PHP falling back to IPv4 if there is not Name available?

Disabling IPv6 isn't working. Adding the v4 address to my hosts file has no impact.

René Höhle
  • 26,716
  • 22
  • 73
  • 82

1 Answers1

0

Ok that problem was caused by the beta of OSX. I've make a new installation of OSX 12.3 and it was working well.

René Höhle
  • 26,716
  • 22
  • 73
  • 82