How to get the absolute path of a file

i need the absolute or full path of a file for a env file

So… just prefix it with the Document Root of your website? You can view those in the various domain screens in the control panel (Addon Domains, Subdomains, Parked Domains). Note that you may need to add /htdocs to them if it isn’t included.

1 Like

Does <?php echo __DIR__; ?> work?

4 Likes

Or <?php echo $_SERVER["DOCUMENT_ROOT"]; ?>

3 Likes

Only supported in repl

env file is supported here too, but putenv() isn’t.

4 Likes

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