Jump to content


Photo

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


  • Please log in to reply
5 replies to this topic

#1 eirinikos

eirinikos
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 10 July 2006 - 03:07 PM


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.

#2 willfitch

willfitch
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts
  • LocationNew Hope, PA

Posted 10 July 2006 - 07:11 PM

Would you mind posting your script?
Zend Certified Engineer (ZEND001989)
www.willfitch.com

#3 eirinikos

eirinikos
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 July 2006 - 03:13 AM

sure..
<?php

echo getcwd():

?>

Output:

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

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\

#4 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 12 July 2006 - 06:03 AM

Hmmmmmmmmmm...

echo $_SERVER["DOCUMENT_ROOT"];

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

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#5 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 12 July 2006 - 06:42 AM

Is it the you using PHP as an Apache module, or are you using the CGI version?

#6 eirinikos

eirinikos
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 July 2006 - 10:52 PM

New script:
<script language="php">

echo getcwd();

echo "<BR><BR>";

echo $_SERVER["DOCUMENT_ROOT"];

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

</script>

Output:
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


I am using the apache module.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users