PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.info.servers.unix > determing real url on virtual host
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.info.servers.unix Web servers for UNIX platforms.

determing real url on virtual host

Réponse
 
LinkBack Outils de la discussion
Vieux 04/03/2005, 05h21   #1
yawnmoth
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut determing real url on virtual host

say i have two domain names - adomain.com and anotherdomain.com.
adomain.com's base directory is the same as
anotherdomain.com/~adomain/. if i were running a php script on
adomain.com, how might i determe the real path of that php script (ie.
not the virtual path)?

  Réponse avec citation
Vieux 04/03/2005, 08h11   #2
David Efflandt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: determing real url on virtual host

On 3 Mar 2005 21:21:04 -0800, yawnmoth <terra1024@yahoo.com> wrote:
> say i have two domain names - adomain.com and anotherdomain.com.
> adomain.com's base directory is the same as
> anotherdomain.com/~adomain/. if i were running a php script on
> adomain.com, how might i determe the real path of that php script (ie.
> not the virtual path)?


Why not make a sample script that prints all env variables to find out?
I am not familiar with php, but judging from CGI, you might get something
useful from SCRIPT_FILENAME
  Réponse avec citation
Vieux 04/03/2005, 09h29   #3
yawnmoth
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: determing real url on virtual host


David Efflandt wrote:
> On 3 Mar 2005 21:21:04 -0800, yawnmoth <terra1024@yahoo.com> wrote:
> > say i have two domain names - adomain.com and anotherdomain.com.
> > adomain.com's base directory is the same as
> > anotherdomain.com/~adomain/. if i were running a php script on
> > adomain.com, how might i determe the real path of that php script

(ie.
> > not the virtual path)?

>
> Why not make a sample script that prints all env variables to find

out?
> I am not familiar with php, but judging from CGI, you might get

something
> useful from SCRIPT_FILENAME


i did. here's the contents of that script:

<?
print_r($_ENV);
echo '<p>--<p>';
print_r($_SERVER);
?>

nothing that was printed out showed the real path - only the virtual
paths (or the filesystem paths, which i can't use to construct
alternative url's from).

  Réponse avec citation
Vieux 04/03/2005, 13h14   #4
chris-usenet@roaima.co.uk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: determing real url on virtual host

yawnmoth <terra1024@yahoo.com> wrote:
> nothing that was printed out showed the real path - only the virtual
> paths (or the filesystem paths, which i can't use to construct
> alternative url's from).


What about using one or more of DOCUMENT_ROOT, REQUEST_URI, and
SERVER_NAME?

Chris
  Réponse avec citation
Vieux 04/03/2005, 16h33   #5
yawnmoth
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: determing real url on virtual host


chris-usenet@roaima.co.uk wrote:
> yawnmoth <terra1024@yahoo.com> wrote:
> > nothing that was printed out showed the real path - only the

virtual
> > paths (or the filesystem paths, which i can't use to construct
> > alternative url's from).

>
> What about using one or more of DOCUMENT_ROOT, REQUEST_URI, and
> SERVER_NAME?
>
> Chris


the real path: /~adomain/
DOCUMENT_ROOT: /home/adomain/
REQUEST_URI: /
SERVER_NAME: www.adomain.com

that's when i view the webpage by going to adomain.com.

when i view the webpage by going to anotherdomain.com/~adomain/, i get
the information that i want, but at that point, i already know it, so
such a lookup is pointless. i want to determine the real path when i'm
accessing the webpage from adomain.com.

  Réponse avec citation
Vieux 04/03/2005, 20h30   #6
chris-usenet@roaima.co.uk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: determing real url on virtual host


> chris-usenet@roaima.co.uk wrote:
>> yawnmoth <terra1024@yahoo.com> wrote:
>> > nothing that was printed out showed the real path - only the

> virtual
>> > paths (or the filesystem paths, which i can't use to construct
>> > alternative url's from).

>>
>> What about using one or more of DOCUMENT_ROOT, REQUEST_URI, and
>> SERVER_NAME?
>>
>> Chris


yawnmoth <terra1024@yahoo.com> wrote:
> the real path: /~adomain/


> DOCUMENT_ROOT: /home/adomain/
> REQUEST_URI: /
> SERVER_NAME: www.adomain.com


> that's when i view the webpage by going to adomain.com.


Yes. All good so far. And when you run the same script via the other
domain...?

> when i view the webpage by going to anotherdomain.com/~adomain/, i get
> the information that i want, but at that point, i already know it, so
> such a lookup is pointless. i want to determine the real path when i'm
> accessing the webpage from adomain.com.


Now I'm totally confused. Two of us have suggested the relevant variables
to you, a combination of which should tell you everything you need to
know about the server name, the request URI and the real script path,
yet this isn't enough.

Somewhere either you've not explained yourself sufficiently or one of
the three of us has misunderstood. Same net effect.

Chris
  Réponse avec citation
Vieux 05/03/2005, 00h39   #7
David Efflandt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: determing real url on virtual host

On 4 Mar 2005 08:33:54 -0800, yawnmoth <terra1024@yahoo.com> wrote:
>
> chris-usenet@roaima.co.uk wrote:
>> yawnmoth <terra1024@yahoo.com> wrote:
>> > nothing that was printed out showed the real path - only the

> virtual
>> > paths (or the filesystem paths, which i can't use to construct
>> > alternative url's from).

>>
>> What about using one or more of DOCUMENT_ROOT, REQUEST_URI, and
>> SERVER_NAME?
>>
>> Chris

>
> the real path: /~adomain/
> DOCUMENT_ROOT: /home/adomain/
> REQUEST_URI: /
> SERVER_NAME: www.adomain.com
>
> that's when i view the webpage by going to adomain.com.
>
> when i view the webpage by going to anotherdomain.com/~adomain/, i get
> the information that i want, but at that point, i already know it, so
> such a lookup is pointless. i want to determine the real path when i'm
> accessing the webpage from adomain.com.


The real path is the absolute (full) system path. Any URL or URI path is
a virtual path that you used to access the resource. How do you propose
for 1 virtual host to know the URL path via another virtual host unless
you include that info in the script itself (it is NOT going to be in env
automatically).
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h54.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12911 seconds with 15 queries