Re: Howto detect the hostname of the server?

From: Date: Sat, 26 Nov 2011 03:20:14 +0000
Subject: Re: Howto detect the hostname of the server?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-315819@lists.php.net to get a copy of this message
On 11/25/2011 7:35 PM, Simon J Welsh wrote:
On 26/11/2011, at 1:14 PM, Andreas wrote:
Hi, how could I identify the server the script runs on? I've got a testserver on Windows and a remote system on Linux that need a couple of different settings like IP and port of db-server or folder to store logfiles. I'd like to do something like: if ( $_SERVER['some_key'] = 'my_test_box' ) {
    $db_host = '1.1.1.1';
    $db_port = 1234;
} else {
    $db_host = '2.2.2.2';
    $db_port = 4321;
} I looked into phpinfo() but haven't found anything helpful, yet. Have I overlooked something or is there another way to identify the server?
php_uname('n'); http://php.net/php_uname
folks try: $_SERVER['SERVER_NAME'] Cheers, Curtis

« previous php.general (#315819) next »