Re: absolute path of any PHP script?

From: Date: Sat, 06 Jan 2001 05:23:34 +0000
Subject: Re: absolute path of any PHP script?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-33018@lists.php.net to get a copy of this message
err, it's 0630 AM here and I've been up all night, so sorry: ... of any script _in_ the script itself ... ... it'll output '/alias.script.php' while I need ... ^^^^ At 06:18 6.1. 2001, Dallas Kropka wrote the following: -------------------------------------------------------------- >hm, I guess I didn't make myself clear: > >I need to know absolute translated path of any script it the >script itself. (this ain't better...) > >let's suppose I have an NT box with docroot in c:/www, >and c:/www/directory/ is available from web (aliased) as >[www.domain.tld]/alias/ > >now, let's suppose there are two files in the directory: > >script.php ><? include( 'include.inc' ) ?> > >include.inc ><? echo $HTTP_SERVER_VARS['PHP_SELF'] ?> > >now, if I request www.domain.tld/alias/script.php, >it'll output '/alias.script' while I need >'c:/www/directory/include.inc'. > >At 20:14 6.1. 2001, Dallas Kropka wrote the following: >-------------------------------------------------------------- >>$bar_script_location = $HTTP_HOST.$PHP_SELF; >> >>add this to the top of every page you will need that information.... you may >>need to declare as global. >> >> >> >> >> >>----- Original Message ----- >>From: "Cynic" <cynic@mail.cz> >>To: <php-general@lists.php.net> >>Sent: Friday, January 05, 2001 6:23 AM >>Subject: [PHP] absolute path of any PHP script? >> >> >>> how do I get the absolute path to any PHP script currently >>> being executed? >>> __FILE__ does not help here, because if I have >>> require( '../bar.php' ) ; >>> in foo.php, __FILE__ in foo.php will contain e. g. >>> 'c:/wwwroot/aaa/bbb/foo.php' (on windows), but in bar.php it >>> will contain '../bar.php' (e. g. the argument passed to >>> require()). >>> I know I could write a function to do this, but surely >>> there must be an easier way I just missed. >>> >>> TIA >>> >>> ____________________________________________________________ >>> Cynic: >>> >>> A member of a group of ancient Greek philosophers who taught >>> that virtue constitutes happiness and that self control is >>> the essential part of virtue. >>> >>> cynic@mail.cz >>> >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >>> For additional commands, e-mail: php-general-help@lists.php.net >>> To contact the list administrators, e-mail: php-list-admin@lists.php.net >>> >------end of quote------ > > >____________________________________________________________ >Cynic: > >A member of a group of ancient Greek philosophers who taught >that virtue constitutes happiness and that self control is >the essential part of virtue. > >cynic@mail.cz ------end of quote------ ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz

« previous php.general (#33018) next »