Andrew Ballard wrote:
> I want to store the name of the computer that is executing a script in
> some log tables. (Our servers are load balanced, and I'd like to be
> able to determine which physical machine is serving each request.)
> On my development machine (Windows PC running the debugger in Zend
> Studio), I can find the name in three places:
> On the development server, only the first works; $_ENV and $_SERVER
> both return NULL and throw an undefined index notice.
> I'm concerned about the reliability of all of these methods, since it
> seems that they are not always available and all three can be easily
> overridden inside a script. However, I notice that the header
> generated by phpinfo() remains correct even when I manually spoofed
> all three values on my development machine. Is there a reliable way to
> find this value?
Well, I looked at all the variables that are available. Then I looked at the
data in the output of phpinfo().
The only place that I can find the information that you are looking for is
available in the "PHP Configuration" section and it is in the System
So, looking at the phpinfo() page, I noticed the first comment down had a
method/function for converting the output of phpinfo() into a multidimensional
array. Taking the output of that users function, you can access the data the
data you are looking for.
So, here is a link to the phpinfo() page.
>From there, get the function called phpinfo_array()
take the output of that and run it through the following set of commands.
$data = phpinfo_array(TRUE);
list(, $server_name) = explode(' ', $data['PHP Configuration']['System']);
print( $server_name );
This will give you what you are looking for.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php