Getting the full path of a file/folder

Username (e.g. epiz_XXX) or Website URL


Error Message

500 internal service error

Other Information

Hello, I’m currently working on a website and something I’m setting up requires the full path for a file. Entering /[filename] (which is where the file is) doesn’t work and gives a 500 internal service error. Is there any way to get the actual file path?

Use this php code to get directory path:

echo getcwd();
1 Like

Thank you! By the way, is there any other way to find the path without using a PHP file?

I don’t really know. In fact, I found that code after googling :sweat_smile:

In JavaScript, you can use window.location.pathname.

1 Like

Wait, why do you need to full path? Also, PHP will return the path from the location of where PHP is installed, and it is not installed in the root, so it will not return the full path anyway.

You also do not have root access on the server, so a full path is not allowed to be used here.

The 500 error is because that path does not exists. A file with the URL of “” has a full path of “/folder/file.php”, you should NEVER include the root directory (htdocs) to get a files path here (Or really anywhere), it will never work.

If you type “/[filename]” for the file path, it is searching for “[filename]” witch clearly does not exist. Use “/[filename]” instead.


File paths can only be checked on the server, which is what only PHP code can do. You can’t see server paths from the browser (thankfully), and there is no legitimate reason anyone would ever need to.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.