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
Web Hosting - PHP fsockopen : How to connect to an external IPv6 address ?
Related questions
- Max_execution_time how to increase time
8204
24.01.2021 17:14
- How do I limit upload_max_filesize? PHP.ini method not working
8099
06.12.2022 11:02
- Update MySQL Version
8099
14.02.2018 03:27
- I can't login to my account. Reset password don't help
7851
25.02.2020 22:06
- Connect to mysql database
7498
28.02.2018 16:52
- Cannot put SSL on my domain
6983
03.04.2019 19:20
- How do I get rid of the default 'site under construction' page?
6608
27.10.2022 14:35
- Trying to connect my OVH domain to shopify store
6288
13.06.2021 22:43
- Increase PHP Post Max Size and PHP Time Limit
5839
20.09.2023 07:11
- Layer 7 DDoS protection on Web hosting
5774
17.08.2025 13:59