Jump to content

Archived

This topic is now archived and is closed to further replies.

eirinikos

getcwd shows that php thinks its in the wrong folder...

Recommended Posts


Hi.. I'm having a strange problem where the current working directory is showing one folder up from where it should be.

Im running the latest apache (2.2) and PHP 5 on windowsXP

My doc root is "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"

Whenever I run a php script in the htdocs folder and echo getcwd() I get:

C:\Program Files\Apache Software Foundation\Apache2.2

I dont get it..the include path is set to "." for relative paths..
I tried setting the doc root in the php.ini file also
I dont know what else the problem can be.

Share this post


Link to post
Share on other sites
sure..
[code]
<?php

echo getcwd():

?>[/code]

[b]Output:[/b]

[code]
C:\Program Files\Apache Software Foundation\Apache2.2
[/code]

the location of the file is C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php
the doc root of the web server is C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\

Share this post


Link to post
Share on other sites
Hmmmmmmmmmm...
[code=php:0]

echo $_SERVER["DOCUMENT_ROOT"];

echo " - " . $_SERVER["SCRIPT_FILENAME"];
[/code]

Share this post


Link to post
Share on other sites
Is it the you using PHP as an Apache module, or are you using the CGI version?

Share this post


Link to post
Share on other sites
New script:
[code]<script language="php">

echo getcwd();

echo "<BR><BR>";

echo $_SERVER["DOCUMENT_ROOT"];

echo " <BR><BR> " . $_SERVER["SCRIPT_FILENAME"];

</script>[/code]

Output:
[code]C:\Program Files\Apache Software Foundation\Apache2.2

C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/

C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/info.php[/code]


I am using the apache module.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.