How can I identify the server IP address in PHP?
If you are using PHP in bash shell you can use:
$server_name=exec('hostname');
Because $_SERVER[] SERVER_ADDR, HTTP_HOST and SERVER_NAME are not set.
$_SERVER[] SERVER_ADDR
HTTP_HOST
SERVER_NAME