Click to See Complete Forum and Search --> : [RESOLVED] Undefined index: PATH_TRANSLATED


Markbad311
11-19-2006, 08:40 PM
I am using this to save me sometime when doing links... It gives me the appropriate results but also gives me errors too.. Funny it works and errors at the same time...


In my source code I get this

b>Notice</b>: Undefined index: PATH_TRANSLATED in <b>C:\WebServ\wwwroot\htdocs\v2\include\headNav.php</b> on line <b>4</b><br />

Line 4 is this in my script headNav.php


/*line 3*/print '<div id="masthead">
<a href="'.$_SERVER['PATH_TRANSLATED'].'/v2/" title="Erie Business Guide" >'; //line 4

NogDog
11-19-2006, 08:57 PM
When you say it gives "appropriate results", is something actually output in the HTML source before the "/v2/" in the link?

As far as why, it could have something to do with the following from http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.server
'PATH_TRANSLATED'

Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping.

Note: As of PHP 4.3.2, PATH_TRANSLATED is no longer set implicitly under the Apache 2 SAPI in contrast to the situation in Apache 1, where it's set to the same value as the SCRIPT_FILENAME server variable when it's not populated by Apache. This change was made to comply with the CGI specification that PATH_TRANSLATED should only exist if PATH_INFO is defined.

Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO.
For that matter, I don't think you want the PATH_TRANSLATED value anyway, as that's a local filesystem path, not a document root path. So my guess is it's just outputting [b]href="/v2/", which is valid for a HTML link.