When the script runs under Apache, I insert the value $_SERVER['SERVER_NAME']in the error message sending message.
However, if the web script creates a workstation with nohup php ..., $_SERVER['SERVER_NAME']it turns out to be empty there. Thus, if an error occurred, it reported without a host name.
Can I reliably get the hostname using PHP without calling the Unix command hostname?
source
share