To get directory path only use dirname(FILE). For example to include other file in same directory use:

Later the PHP version 5.3.0 and later versions introduced a new constant called DIR which is the short form of the dirname(FILE). You can also use this in replacement of what we used earlier. Now, you can use above script like:

To simply print the absolute directory path of PHP script located in: