note 118841 added to function.gethostbyname
| From: | DennisB. | Date: | Mon, 15 Feb 2016 12:33:13 +0000 |
| Subject: | note 118841 added to function.gethostbyname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204942@lists.php.net to get a copy of this message | ||
Options for the underlying resolver functions can be supplied by using the RES_OPTIONS environmental
variable. (at least under Linux, see man resolv.conf)
Set timeout and retries to 1 to have a maximum execution time of 1 second for the DNS lookup:
<?php
putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');
gethostbyname($something);
?>
You should also use fully qualified domain names ending in a dot. This prevents the resolver from
walking though all search domains and retrying the domain with the search domain appended.
----
Server IP: 72.52.91.14
Probable Submitter: 93.159.255.203
----
Manual Page -- http://php.net/manual/en/function.gethostbyname.php
Edit -- https://master.php.net/note/edit/118841
Del: integrated -- https://master.php.net/note/delete/118841/integrated
Del: useless -- https://master.php.net/note/delete/118841/useless
Del: bad code -- https://master.php.net/note/delete/118841/bad+code
Del: spam -- https://master.php.net/note/delete/118841/spam
Del: non-english -- https://master.php.net/note/delete/118841/non-english
Del: in docs -- https://master.php.net/note/delete/118841/in+docs
Del: other reasons-- https://master.php.net/note/delete/118841
Reject -- https://master.php.net/note/reject/118841
Search -- https://master.php.net/manage/user-notes.php