If I am writing my own code correctly, $_SERVER['PHP_SELF'] should return the full path of the script and filename from the document root of the website. If your host has your subdomain set up right, you should be able to issue: "echo $_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']" in a php script and have it return the complete path of the file via the filesystem... take out the "DOCUMENT_ROOT" and you should be left with the path the webserver uses to the script. The above example is what I use to include files not in the same directory, minus the php_self obviously. However, in cases where I submit a form back onto itself I use $_SERVER['PHP_SELF'] all the time. Hence my questioning if you know what the server is using for DOCUMENT_ROOT. If it thinks the document root is "/var/www/domain.com/" and the PHP_SELF refers to "/sub/form.php", then php_self will not return what you expect, nor want it to. I would suggest taking a look at: http://us3.php.net/reserved.variables for more help. Hope that helps, Tony Kurt Granroth wrote: > 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 : >> >>> 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: >>> >>> >>> >>> 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