root path in php

hi folks

i am used to ASP, not PHP, so pls excuse the newbie question…

i have taken over a site the is using the following script to protect access to a folder: Redirecting...
it requires the path to the .htaccess file.

if my absolute path is: "d:\hshome\account\domain.net"
and the .htaccess file is in : “d:\hshome\account\domain.net\folder1.htaccess”

… what will the root path be? does it include the drive letter?
thanks!

I’m not too experienced in PHP myself, but unlike ASP you won’t necessarily need the absolute path to a file with php with write operations.

e.g. I use this snippet to write to a file using a relative path from the script to the file in question. (Note the forward slashes, too.) Or you can use a preceding ‘/’ to make it relative to the root folder of the website.

$filename=“folder/another_folder/my_file.txt”;
$file = fopen($filename,“w”) or die(“Can’t open file”);
etc.

that relative path should work best, but if you need absolute try the d:\hshome\user\domain.com format many times you need \ on PHP for the slashes, just as a note.