Actually, I should have specified that the PHP scripts are all 3rd
party ones. If they are scripts that I wrote, then there are always
ways around it. But the 3rd party ones invariably do 'dirname' on
PHP_SELF (or something very similar). That's why I want to know a
way around that at a higher-level. Maybe some php.ini setting or
somesuch.
On Jan 15, 2006, at 5:07 PM,
alex@crackpot.org wrote:
> Try a test script like this : 'var_dump($_SERVER);'. This will
> show you all the
> variables provided by the web server (like DOCUMENT_ROOT, PHP_SELF,
> etc.) There
> may be one which has what you want. Maybe PATH_TRANSLATED?
>
> alex
>
> Quoting Kurt Granroth <plug-discuss@granroth.org>:
>
>> This isn't directly Linux related but since I know there are a lot of
>> PHP folks on this list, I thought I'd ask here.
>>
>> I have multiple domain and multiple subdomain support with my web
>> hosting enabled mostly by using mod_rewrite. The end result is that
>> I can define my domains and subdomains by just creating the proper
>> directory structure.
>>
>> For instance, say I have "sub.domain.com", "other.domain.com", and
>> "cool.com". I would simply create following directory structure:
>>
>> $DOCUMENT_ROOT/domain.com/sub/
>> $DOCUMENT_ROOT/domain.com/other/
>> $DOCUMENT_ROOT/cool.com/
>>
>> So far, so good. That all works just as expected. Now say, though,
>> that I have a PHP file 'index.php' in the directory 'domain.com/sub'
>> that looks like so:
>>
>> <?php echo $_SERVER["PHP_SELF"] ?>
>>
>> I then execute the script using "http://sub.domain.com/index.php".
>> The result:
>>
>> /domain.com/sub/index.php
>>
>> This is technically accurate... but not at all what I want. Why?
>> Because typically, PHP code uses the dirname() of this to find other
>> relative scripts. If you do that, though, then the constructed URL
>> will look like so:
>>
>> http://sub.domain.com/domain.com/sub/someother.php
>>
>> instead of
>>
>> http://sub.domain.com/someother.php
>>
>> So it seems that I somehow have to "fool" PHP into thinking that
>> PHP_SELF (and SCRIPT_NAME and SCRIPT_FILENAME) is "/index.php"
>> instead of "/domain.com/sub/index.php"
>>
>> Is that even possible? If so, how. If not, is there any way around
>> this at all?
>>
>> Thanks!
>> Kurt
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
>> To subscribe, unsubscribe, or to change you mail settings:
>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>>
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
>
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss