Login    Forum    Register    Search    Quick Links   

Board index » HELP AND ADVICE » G33K'S CORNER




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: php
 Post Posted: Fri Dec 15, 2006 5:36 pm 
Offline
that was a stupid comment btw
User avatar

Joined: Wed Mar 03, 2004 12:40 pm
Posts: 109345
Location: manchester
im kinda stuck using this
$dnsip = gethostbyname($feature_name);
works for full dns name but fails on for example nagios

on the same machine though i have the search paths added
horizon:/var/www/ops-ssl/datacentre# more /etc/resolv.conf
search search its.manchester.ac.uk mcc.ac.uk mc.man.ac.uk fin.manchester.ac.uk sdt.manchester.ac.uk ds.man.ac.uk
nameserver use domain.200.6
nameserver use domain.203.17
nameserver use domain.203.7
nameserver use domain.200.2

so
horizon:/var/www/ops-ssl/datacentre# nslookup nagios
Server: use domain.200.6
Address: use domain.200.6#53

Name: nagios.its.manchester.ac.uk
Address: use domain.249.4

returns the correct IP

why dose it fail in php ?

_________________
Image
Image


Top 
 Profile  
 
 Post subject:
 Post Posted: Sat Dec 16, 2006 12:00 pm 
Offline
I'm ghey 4 teh Hoff!
User avatar

Joined: Wed Sep 21, 2005 5:18 pm
Posts: 4142
I remember trying this and never getting it working, but i didn't really try to solve the issue.

Take it you've looked through the comments at http://us2.php.net/manual/en/function.gethostbyname.php

Those are usually the best place to start with tracking down issues in php functions, as often folks find a solution years before you have a problem :P


Top 
 Profile  
 
 Post subject:
 Post Posted: Sat Dec 16, 2006 5:51 pm 
Offline
PFY wannabe
User avatar

Joined: Sun Jan 02, 2005 11:51 pm
Posts: 3295
Location: South, but not far south enough :/
Maybe it would be because the manual says that it should be a fully qualified domain name, whereas your local DNS client will search your local network.

Maybe a good solution would be to detect if the submitted variable has a '.' in it and if it dosent then to append the local networks on to the end and surch through them in turn.

_________________
Image

"I wish my lawn was emo, so it would cut itself...."


Top 
 Profile  
 
 Post subject: cheers
 Post Posted: Sat Dec 16, 2006 7:34 pm 
Offline
that was a stupid comment btw
User avatar

Joined: Wed Mar 03, 2004 12:40 pm
Posts: 109345
Location: manchester
cheers - unfortuanly we have around 100 diff dns domains/sub domains to check but i never thought of doing this
<?php
$ip = rtrim(`/usr/bin/dig $host A +short`);
?>

it will solve 80% of me problems untill i hit and example like a machine slappy

slappy.mc.man.ac.uk
see slap
slappy.its.manchester.ac.uk
slappy.umist.ac.uk
etc etc

all diff machines - this is just a example but i know loads that will do this

_________________
Image
Image


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 4 posts ] 

Board index » HELP AND ADVICE » G33K'S CORNER


Who is online

Users browsing this forum: No registered users and 0 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
  • Shoutbox
  • Shout Message



cron