Re: $PHP_SELF
| From: | David | Date: | Sun, 06 Jan 2002 02:11:34 +0000 |
| Subject: | Re: $PHP_SELF | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11320@lists.php.net to get a copy of this message | ||
Steve Yates said something on 05 Jan 2002, in php.windows:
> "David" <php@warpedweb.net> wrote:
>> Gregory Hart said something on 05 Jan 2002, in php.windows:
>> > I understand that the variable $PHP_SELF doesn't always work.
>> > I'm using Windows 98 SE with PHP 4.1.1. Is there any way to get
>
> I think I have seen $PHP_SELF not work on PWS...is that what you
> have? You might try $PATH_INFO or $SCRIPT_URL.
>
>> $SCRIPT_NAME usually works for me on most servers.
>
> I think this returns the program or CGI name. At least is does on
> the versions of Apache that I've tried.
>
True, on Apache, PHP_SELF work, on others, (IIS, Xitami) it will not, but
SCRIPT_NAME does.
If you put a little bit of code at the beginning of your script like:
if(isset($PHP_SELF)) $THIS_SCRIPT = $PHP_SELF;
else $THIS_SCRIPT = $SCRIPT_NAME;
Then there is $PATH_INFO, which is even less consistant.
Regards,
David