#38341 [Opn->Bgs]: Problem in getting hostname when the program runs as cronjob

From: Date: Sat, 05 Aug 2006 11:49:41 +0000
Subject: #38341 [Opn->Bgs]: Problem in getting hostname when the program runs as cronjob
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-100380@lists.php.net to get a copy of this message
ID: 38341 Updated by: tony2001@php.net Reported By: manikandan dot r at greynium dot com -Status: Open +Status: Bogus Bug Type: Output Control PHP Version: 5.1.4 New Comment: HOST variables comes from the web server, so it doesn't exist with CLI. There is also HOSTNAME environment variable, which is usually set on *nix systems. Previous Comments: ------------------------------------------------------------------------ [2006-08-05 09:15:07] manikandan dot r at greynium dot com Description: ------------ I used $_SERVER global variable to get the hostname and it is working fine, when the programs run in command line. But i was not get the value of the hostname [ $_SERVER['HOST']] when the file runs as cronjob. How to get the value of hostname? ---- Mani Reproduce code: --------------- echo $_SERVER['HOST']; Expected result: ---------------- php5.greynium.com -My development server hostname. Actual result: -------------- Empty ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38341&edit=1

« previous php.bugs (#100380) next »