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 — ホスト名を取得する
gethostname() 関数は、ローカルのマシンに設定されている標準的なホスト名を取得します。
この関数にはパラメータはありません。
成功時にはホスト名を示す文字列。失敗時には false
を返します
例1 簡単な gethostname() 関数の使用例
<?php
echo gethostname(); // 出力の例: 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