The Two Percent

Hire Me

Finding the Absolute Path of a directory with PHP

Just a quick one this, but something that is really useful if you are installing scripts on a server and need to know the absolute path from your servers root for the config.

Create a php text file (i.e directory.php), then copy the following in to it :

echo dirname(__FILE__);

This will then output the full directory structure of the files location.  Simple and easy, and can save you hours of trial and error!