Re: Questions about $_SERVER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30 August 2010 21:32, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx> 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>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux