Jump to content

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


eirinikos

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.
Link to comment
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\
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.