Re: Quick question regarding getcwd() and directory location.

From: Date: Sat, 23 Aug 2008 20:03:33 +0000
Subject: Re: Quick question regarding getcwd() and directory location.
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-278571@lists.php.net to get a copy of this message
Thanks for this David, i was using REQUEST_URI and other $_SERVER info and mixed that together. It worked in some situations but on hosted servers (like GoDaddy and others like that where they use a complicated directory setup) it does not work. Olafur Waage 2008/8/23 David Otton <phpmail@jawbone.freeserve.co.uk>: > 2008/8/23 Ólafur Waage <olafurw@gmail.com>: > >> Robert, thanks for the reply but i had tried __FILE__ and __DIR__ >> (which is dirname(__FILE__)) but it doesnt work. >> >> And thanks for the reply also Ashley but as i said in my first post, i >> had tried $_SERVER with limited results > > If checking the output of phpinfo() doesn't help (and it looks like it > won't), I'd suggest starting with REQUEST_URI, then, if you know where > your webroot is, you should be able to calculate the path to the > target directory ("/var/www/example/../test/" in your original > example) by gluing bits of path together. Hardly an ideal solution as > it needs configuration, but it would work. > > I think this is really a mod_rewrite problem, as by the time PHP takes > over you've lost the information you need. You may have better luck in > a forum devoted to mod_rewrite, but I'm not optimistic that it has a > "what file would have handled this request if mod_rewrite hadn't run" > parameter. I think you're going to have to build your directory path > from the information in the original request and some configuration > glue. Good luck > > (BTW, I initially thought there might be something in mod_autoindex to > run a custom script, but it doesn't look like there is.) > > -- > > http://www.otton.org/ >

« previous php.general (#278571) next »