Re: Questions about $_SERVER

From: Date: Mon, 30 Aug 2010 19:53:46 +0000
Subject: Re: Questions about $_SERVER
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.general 
Request: Send a blank email to php-general+get-307759@lists.php.net to get a copy of this message
On 30 August 2010 21:32, Paul M Foster <paulf@quillandmouse.com> wrote: > On Sun, Aug 29, 2010 at 06:04:23PM +0200, Per Jessen wrote: > >> Jason Pruim wrote: >> >> > My understanding of how shared hosting works would make this near >> > impossible... Basically Apache grabs a header that is sent at the >> > initial connection which includes the destination hostname and from >> > there it translates it to the proper directory on the shared host. >> > >> > All the IP's though are based off of the parent site's server... >> > >> > Now with dedicated hosting where you have the entire machine you can >> > do what you are looking at because the IP address will always >> > translate back to your website. >> >> AFAICT, Tedd was not asking about the server, he's asking about the >> client. > > No, he's talking about the server. But the server he's using may offload > the processing of a script to another machine. So > > $_SERVER['SERVER_ADDR'] and $_SERVER['SERVER_NAME'] > > both relate to the server which the client is originally communicating > with. But he wants to know if he can get the same information about a > different remote server which is processing a script for him. The > problem is that we have: > > $_SERVER['REMOTE_ADDR'] > > but no > > $_SERVER['REMOTE_NAME'] > > So the question is, how would he get that last variable. It becomes > complicated when using a shared hosting environment, because server > names and IPs aren't a 1:1 mapping. An IP may represent numerous actual > site names. This was part or all of the reason why the http protocol was > revised from 1.0 to 1.1-- in order to accommodate all the domains, which > because of the cramped IP space of IPv4, had to share IPs. So in the > HTTP 1.1 protocol, there is additional information passed about the name > of the domain. > In the scenario painted, it's explicitly stated that one server acts as a client in trying to access a resource on another server. Could you enlighten me as to where the domain name of a client is located in the request header fields? Here's the RFC for HTTP 1.1 http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.3 Regards Peter -- <hype> WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 </hype>

« previous php.general (#307759) next »