Suppose i have this file:
/Home/user/docs/somewhere/inHere.php
And in this php, i want to require this:
/Home/user/other/well/buried/place.php
I know the difference between an absolute and relative path, but cannot seem to figure out how php wants this to look, i keep getting 'file not found or does not exist'
I am on a hostgator shared web server, if that has any bearing on anything.
Firstly you can get the current folder using getcwd()
.
Next, you can use $path = '../../etc'; $realPath = realpath($path)
. It will return false if the path is wrong, and the concrete path without relative ../
's if it is indeed an actual path.
If you still can't get it, var_dump($path);
and then copy the path and try to cd
into it, you should diascover what you are doing wrong at that point.