Best way to get hostname with php
<p>I have a php application that is installed on several servers and all of our developers laptops.  I need a fast and reliable way to get the server's hostname or some other unique and reliable system identifier.  Here's what we have thought of so far:</p>

<p><code>&lt;? $hostname = (!empty($_ENV["HOSTNAME"])) ? $_ENV["HOSTNAME"] : env('HOSTNAME'); ?&gt;</code></p>

<p><code>&lt;? $hostname = gethostbyaddr($_SERVER['SERVER_ADDR']); ?&gt;</code></p>

<p><code>&lt;? $hostname = exec('hostname'); ?&gt;</code></p>

<p>What do you think?</p>
