Hello,
In a PHP script running on my OVHCloud "Hébergement Perso", I use fsockopen towards an external server. When I use the IPv4 address of that server, my script works fine. That server (an RPi behind SFR box) will lose soon its IPv4 address and I need now to use its IPv6 address in my script.
I tried several syntax with the IPv6 address:
$fp = fsockopen("2a02:...4]", 1042, $errNo, $errStr, 10);
$fp = fsockopen("2a02:...4", 1042, $errNo, $errStr, 10);
$fp = fsockopen("tcp://[2a02:...4]", 1042, $errNo, $errStr, 10);
etc
But they all fail, PHP (PHP7.3, PHP8.0, ...) says :
php_network_getaddresses: getaddrinfo for 2a02:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxx4 failed: Address family for hostname not supported (0)
My issue is similar to [this past one but there is no solution posted there.
I'm sure the IPv6 address is correct, as I can successfully connect to it with netcat from anywhere.
Thanks for your help,
Jerome
PHP fsockopen : How to connect to an external IPv6 address ?
Related questions
- Update MySQL Version
11574
14.02.2018 03:27
- How do I limit upload_max_filesize? PHP.ini method not working
11282
06.12.2022 11:02
- Max_execution_time how to increase time
11204
24.01.2021 17:14
- Connect to mysql database
11077
28.02.2018 16:52
- I can't login to my account. Reset password don't help
10652
25.02.2020 22:06
- Cannot put SSL on my domain
10066
03.04.2019 19:20
- Layer 7 DDoS protection on Web hosting
10056
17.08.2025 13:59
- Abuse Report not working
9352
27.03.2025 07:45
- How do I get rid of the default 'site under construction' page?
9178
27.10.2022 14:35
- Trying to connect my OVH domain to shopify store
8569
13.06.2021 22:43