When a script runs under Apache, I insert $_SERVER['SERVER_NAME'] value into an error reporting e-mail message.
However, if a Web script forks a "worker" job with nohup php ..., $_SERVER['SERVER_NAME'] appears to be empty there. Thus, if an error occurs, it's reported without a host name.
Can I reliably get the host name by means of PHP, without calling Unix hostname command?
-
From Prody
-
You can use _GLOBALS['MACHINENAME'] to obtain the information straight from the globals array.
0 comments:
Post a Comment