How-To: Determine Real hostname in php
May.15, 2008 in
Development, How To
If you need to know the real host name of your server using php, use the following command:
<? echo gethostbyaddr (gethostbyname ($_SERVER["SERVER_NAME"])); ?>
This will return the server’s hostname, not the address that the script is being accessed by. Very useful if you have a script that needs to run on multiple servers.
Tags: Php

Leave a Reply