I need real path ie getcwd();

Hi there i realy hope i can get help on this :slight_smile: 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 :slight_smile:

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% :wink: