PHP root folder

Discussion in 'Plesk for Windows - 8.x and Older' started by gusmanb, Feb 19, 2007.

1. gusmanbGuest

0
Hi.

I'm using Plesk 8.1 and got a weird behavior.

When PHP is used, when tried to acces to a file or directory on the web root folder (I.E.: c:\inetpub\vhosts\domainname\httpdocs\folder) using "/" (I.E.: /folder) the file/folder isn't found.
After some tries i've discovered "/" was pointing to "C:\" and not to the web root folder.

Â¿How can this be solved?

2. holdtotherodGuest

0
I'm working on figuring out the best way to reference the web root folder as well, but I know you can't simply use / to indicate the web root folder. The PHP parser will actually interpret this as the root of the file system. I know that on a Unix-based system, "/" is the root of the drive, and I believe the same is true in Windows. Thus "/" would mean the root of the C drive (or whatever drive letter the root partition is). This can be useful for including files outside of your web root that contain sensitive information you don't want publicly accessible from the web, such as a file containing database login information, etc. Perhaps the best way I know of so far is to either use relative URL's or use the public address such as http://www.someplace.com/somefolder/somedeeperfolder/somefile.php. As for relative URLs, let's say you have a file located at (webroot)/somefolder/somedeeperfolder/somefile.php. You could reference the folders (and thus files/folder in them) quite easily. "../" refers to the parent directory of the current working directory, or in this example, somefolder. "./" refers to the current working directory, or in this example, somedeeperfolder. You can use multiple "./"s to keep going up a level. So for this example, the webroot would be referenced as "./././". I hope this helps