NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
DOCUMENT_ROOT


Joined: 13 Oct 2006
Posts: 14
Reply with quote
$_root = $_SERVER['DOCUMENT_ROOT']

executing the above statement under phped and my target system gives two different results.

under phped it gives the actual path to the script which is running.
on my target system it gives the topmost level which I believe is correct?

comments?
View user's profileFind all posts by BeerFizzSend private message


Joined: 13 Oct 2006
Posts: 14
Reply with quote
I need a function which will always return the root. How do I do this?

Thanks
View user's profileFind all posts by BeerFizzSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
'DOCUMENT_ROOT' is a variable supported by Apache. You may have different DOCUMENT_ROOTs for different virtual hosts.
When you run with debugger (phped), do you use Apache? Probably not and it explains why values differs. I'd recommend you to switch to Apache if your application depends on Apache variables. To get debugger working under Apache, you'll need to install it there. Please proceed with this FAQ post: http://forum.nusphere.com/howto-install-debugger-module-t576.html

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 13 Oct 2006
Posts: 14
Reply with quote
I should add; under settings/embedded web server, the default home directory is set correctly to the root. I believe this is what should be returned, instead the actual path to the script is returned?
View user's profileFind all posts by BeerFizzSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
I could not replicate this problem.
I created project, created a subdirectory in it, created phpinfo file, ran it and after all it shows me project's root, not path to the file.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 13 Oct 2006
Posts: 14
Reply with quote
Well, that does not help me very much.

perhaps this is the difference. Because I was using xampp before phped all my projects are under xampp\htdocs.

the projects which i have created with phped are not under the phped projects path, but rather point to a xampp\htdocs.

$_root = $_SERVER['DOCUMENT_ROOT'];
echo ("Document Root '" . $_root . "'<br>");

the above code definitely gives me the path to the script and not the root.

Can you try creating a project which is not under phped and then execute the above code.

Thanks.
View user's profileFind all posts by BeerFizzSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
if you have xampp, why don't you install dbg debugger there and debug your projects using xampp instead of the internal server as I suggested before?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 13 Oct 2006
Posts: 14
Reply with quote
Give me a link on how to do that, please.
View user's profileFind all posts by BeerFizzSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Smile it's what I did before too Smile

To get debugger working under Apache, you'll need to install it there. Please proceed with this FAQ post: http://forum.nusphere.com/howto-install-debugger-module-t576.html

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
DOCUMENT_ROOT
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic