Page 1 of 1

Path to a file using include() contains a "."

Posted: Thu Nov 06, 2008 12:35 am
by swraman
The line of code is:

include("./home/whatever.php")

what does the ./ mean?


I keep getting errors on that line, but it rins fine on another server. I know it isnt a code error, I found out what the problem was at a while back but I forgot.

The code ./ seems to intend to refer to the root directory of the site. The guy who made this site used it all over, it for some reason works fine on our server but it refuses to operate on my local machine.

thanks

Re: Path to a file using include() contains a "."

Posted: Thu Nov 06, 2008 3:29 am
by onion2k
. is the current working directory, so your script will look for whatever.php in a directory called "home" inside the directory it's currently running in, or in the /home directory of any directories in the include_path ( http://uk3.php.net/manual/en/ini.core.p ... clude-path ).

You can use other 'special' directories like / to get the document root, or .. to get the parent directory.

Re: Path to a file using include() contains a "."

Posted: Thu Nov 06, 2008 11:09 am
by RobertGonzalez
Every directory you are in (except the root directory I believe) will have two special, default directories in it. Those are "." and "..".

"." is the current directory you are in.

".." is the parent directory of the directory you are in (meaning it is the directory directly above the directory you are in).