There is a PHP function gethostname() and php_uname('n') , but both only return the hostname, not the domain name returned by the command hostname -d .
gethostname()
php_uname('n')
hostname -d
Is there a native way that probably also works on Windows without running a new process to get this information?
My tests printed the FQDN of my host:
echo gethostbyaddr(gethostbynamel(gethostname())[0]);
I'm not sure what local DNS configuration is needed to reliably get the FQDN using this sequence of commands. However, you can try ...