All -
I'm running into an issue with php-4.0.6 on linux (glibc 2.1.3) and DNS lookups. PHP was compiled using --enable-safe-mode --with-mysql --prefix=/usr/php --disable-force-cgi-redirect
I didn't compile against external MySQL, but then again, it doesn't make sense how that would affect PHP's ability to do lookups. Maybe I'm missing something.
I haven't added /usr/php/lib/php to /etc/ld.so.conf yet, since it only contains a few .php files.
I used the following code as a test -
<?
echo $domain = system("/bin/nslookup <!-- w --><a class="postlink" href="http://www.google.com">www.google.com</a><!-- w -->");
$host = <!-- w --><a class="postlink" href="http://www.oreillynet.com;">www.oreillynet.com;</a><!-- w -->
$ip = gethostbyname($host);
print "host name $host is $ip.";
$host = gethostbyaddr($REMOTE_ADDR);
print "your name is $host ($REMOTE_ADDR).";
?>
The nslookup works properly and is able to resolve entries consistently.
The gethostbyname and gethostbyaddr calls do not function and simply print out the original values passed to them.
Is there any way to perform something like an strace or have PHP log the specifics of the failure? This is really strange. I'm not running nscd.
I discovered the error while trying to connect to an external MySQL db by hostname. I was greeted by a friendly "MySQL Connection Failed: Unknown MySQL Server Host mysql.domain.com". Connecting by specifying an IP works perfectly.
Any suggestions, diagnostic scripts or hints would be greatly appreciated.
Thanks!
I'm running into an issue with php-4.0.6 on linux (glibc 2.1.3) and DNS lookups. PHP was compiled using --enable-safe-mode --with-mysql --prefix=/usr/php --disable-force-cgi-redirect
I didn't compile against external MySQL, but then again, it doesn't make sense how that would affect PHP's ability to do lookups. Maybe I'm missing something.
I haven't added /usr/php/lib/php to /etc/ld.so.conf yet, since it only contains a few .php files.
I used the following code as a test -
<?
echo $domain = system("/bin/nslookup <!-- w --><a class="postlink" href="http://www.google.com">www.google.com</a><!-- w -->");
$host = <!-- w --><a class="postlink" href="http://www.oreillynet.com;">www.oreillynet.com;</a><!-- w -->
$ip = gethostbyname($host);
print "host name $host is $ip.";
$host = gethostbyaddr($REMOTE_ADDR);
print "your name is $host ($REMOTE_ADDR).";
?>
The nslookup works properly and is able to resolve entries consistently.
The gethostbyname and gethostbyaddr calls do not function and simply print out the original values passed to them.
Is there any way to perform something like an strace or have PHP log the specifics of the failure? This is really strange. I'm not running nscd.
I discovered the error while trying to connect to an external MySQL db by hostname. I was greeted by a friendly "MySQL Connection Failed: Unknown MySQL Server Host mysql.domain.com". Connecting by specifying an IP works perfectly.
Any suggestions, diagnostic scripts or hints would be greatly appreciated.
Thanks!