On 10-09-28 04:03 AM, Jason wrote:
> Hi Rob,
>
> I've checked a couple of windows machines (which I admit I had
assumed you were running php on) and the ENV variable "USERDNSDOMAIN" is
definitely what you need. If your php is running on linux, you'll need
to find out the target windows domain some other way (user input/config
file maybe?).
>
> The article is a Win2k based one - there is a link to the XP one in
the top-right corner. However I read both and things haven't changed
from a DNS point of view.
>
> Here's a code snippet for you (run on my network from a windows
workstation)...
>
> <?php
> # assume $_SERVER["USERDNSDOMAIN"] is equal to "xxx.local".
>
> print_r(
dns_get_record("_ldap._tcp.dc._msdcs.".$_SERVER["USERDNSDOMAIN"],DNS_SRV) );
> ?>
>
> And the output (edited for obvious reasons):
>
> Array
> (
> [0] => Array
> (
> [host] => _ldap._tcp.dc._msdcs.xxx.local
> [type] => SRV
> [pri] => 0
> [weight] => 100
> [port] => 389
> [target] => dc2.xxx.local
> [class] => IN
> [ttl] => 545
> )
>
> [1] => Array
> (
> [host] => _ldap._tcp.dc._msdcs.xxx.local
> [type] => SRV
> [pri] => 0
> [weight] => 100
> [port] => 389
> [target] => dc1.xxx.local
> [class] => IN
> [ttl] => 545
> )
>
> )
Hi Jason,
Your assumption was right, I am on a windows machine, Windows Server
2003. I think I understand the problem better now though from your
example. We're currently using PHP 5.2.12 (with an update imminent), but
this doesn't come with dns_get_record() which became available for
Windows with the 5.3.0 branch. That may account for the missing
USERDNSDOMAIN entry. I'm currently pulling the info using an exec() and
nslookup:
nslookup -type=SRV _ldap._tcp.dc._msdcs.%userdnsdomain%
It's not optimal, but it appears to suffice until we upgrade to the 5.3
branch.
Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php