To the prev. note: **NEVER USE***
#`sudo hostname servername`
Some *nix systems will then force to set the 'servername' as new hostname!
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
gethostname — Obtiene el nombre de host
gethostname() obtiene el nombre de host estándar para el equipo local.
Devuelve un string con el nombre de host en caso de éxito,
false
en caso contrario.
Ejemplo #1 Un ejemplo simple de gethostname()
<?php
echo gethostname(); //puede imprimir: sandie
// O, una opción que también funciona antes de PHP 5.3
echo php_uname('n'); //puede imprimir: sandie
?>
To the prev. note: **NEVER USE***
#`sudo hostname servername`
Some *nix systems will then force to set the 'servername' as new hostname!
On Linux, use the command `hostname` to view your host name, or `sudo hostname servername` to set it