# I need real path ie getcwd();

**URL:** <https://forum.kirupa.com/t/i-need-real-path-ie-getcwd/146528>\
**Category:** Uncategorized\
**Created:** [May 2, 2005, 9:16am UTC](https://forum.kirupa.com/t/i-need-real-path-ie-getcwd/146528 "2005-05-02T09:16:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mister](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Mister](https://forum.kirupa.com/u/Mister)\
**Post date:** [May 2, 2005, 9:16am UTC](https://forum.kirupa.com/t/i-need-real-path-ie-getcwd/146528/1 "2005-05-02T09:16:43Z")

</div>

Hi there i realy hope i can get help on this 🙂 Heres my problem…

Im doing a system that can manage .htaccess . htpasswd files. and all that is fine the problem is the path… in .htaccess

In the file .htaccess we have the “line” **AuthUserFile /path/to/.htpasswd .**

So my script inserts all correct value in the .htaccess and it will work if the path would be correct. And here the problem it isn’t!!

I try use the following codes:  
**getcwd();** and it get me the path /var/www/design/.htpasswd .htaccess will not find the file

**$\_SERVER[“PATH\_TRANSLATED”];** and it get me the path /var/subdomain/design/html/.htpasswd .htaccess will not find the file

So after that i looked in my servers error\_log file and there it was a path like  
/home/virtual/site3/fst/var/www/html/ and i tried to manualy insert that path in my .htaccess file and it worked !!

But I want in some way my script to get the REAL path so that other can use it whitout looking in error\_logs and so on 🙂

I kinda figured out that the path /var/subdomain/design/html/ was a link to /var/www/design/ (it’s where my ftp get me when ill brows the server)

I tried to use the function: (im not realy 100% in what this function does)  
**readlink(**’/var/subdomain/design/html’**);**  
And it got me …/…/…/var/www/design

So is there any way to fill out the …/ blanks ?? I knida wanted it to be /home/virtual/site3/fst/… in that path to .

Thx for all help and hints i can get here!! Im from sweden so my english in’t 100% 😉
