title: How to get current system FQDN in php-cli?
body: <p>Is there a way to retrieve current system <em>fully qualified domain name</em> using <strong>php-cli</strong>?</p>
  
  <p>What I'm looking for is php function to retrieve the same thing that hostname -f is doing:</p>
  
  <pre><code>$ hostname -f  #returns needed: system01.dev.lan
  </code></pre>
  
  <p>I tried following:</p>
  
  <pre><code>php_uname('n') // returns: system01
  gethostname() // returns: system01
  gethostbyname(gethostname()) // returns ip address
  gethostbyname(gethostname() . '.') // returns system01
  </code></pre>
  
  <p>$_SERVER dose not exist (because only cli env)</p>
  
  <p>Again, I know I can do this</p>
  
  <pre><code>php -r "var_dump(shell_exec('hostname -f'));"
  </code></pre>
  
  <p>But for this trivial task, I think php should have built in functionality to retreive fqdn.</p>