By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,053 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,053 IT Pros & Developers. It's quick & easy.

Does PHP/Apache fully support IPv6?

P: n/a
Now I am running PHP in Apache on Windows platform, but I need to
migrate it into linux and using IPv6 instead. So I want to know if PHP
fully support IPv6. And how about the workload of this migration?

Thanks for your help.
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
gu*********@yahoo.com (Johnny) wrote in message news:<9f**************************@posting.google. com>...
Now I am running PHP in Apache on Windows platform, but I need to
migrate it into linux and using IPv6 instead. So I want to know if PHP
fully support IPv6. And how about the workload of this migration?

Thanks for your help.


I read the documents of apache on RH9, and found that apache currently
can fully support IPv6, but how about PHP?
Jul 17 '05 #2

P: n/a
In article <9f**************************@posting.google.com >, Johnny's
output was...

I read the documents of apache on RH9, and found that apache currently
can fully support IPv6, but how about PHP?


Searches haven't turned up much, but:

at http://uk.php.net/gethostbyaddr

Somebody called Abe has posted this:

gethostbyaddr() doesn't seem to be able to resolve ip6.int
(ipv6) adresses, so I made a function that can, and works
just like the normal gethostbyaddr().

You need dig and ipv6calc, dig should come with most
distributions, if not, install bind from http://www.isc.org.
ipv6calc can be found at
http://www.bieringer.de/linux/IPv6/ipv6calc/index.html.

function gethostbyaddr6($ip6) {
$ipv6calc = "/bin/ipv6calc";
$dig = "/usr/bin/dig";
$file = popen($ipv6calc." --in ipv6addr --out revnibbles.int
".escapeshellarg($ip6), r);
$ip = fread($file, 128);
pclose($file);
if ((substr($ip, 0, 5) == "Error") || (!$ip)) return "Address is not a
valid IPv6 address";
$file = popen($dig." ptr ".$ip, r);
while (!feof ($file)) {
$buffer = fgets($file, 128);
if (substr($buffer, 0, 1) == ";") continue;
$buffer = explode(" ", $buffer);
if ($buffer[3] == "PTR") {
$host = substr(trim($buffer[4]), 0, -1);
pclose($file);
return $host;
}
}
pclose($file);
return $ip6;
}

echo gethostbyaddr6($_SERVER[REMOTE_ADDR]);
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.