How To Find The Full Path to a File Using PHP

Posted by Keefr April 27th, 2012

Was going to write up a little piece on how to find the current file’s directory on a webserver, but the little article below does a good job of explaining it. I use this all the time for creating my .htaccess/.htpasswd combo, but can see other times when this would be useful as well.

I’ve adopted their code snippet for my own TextExpander time saving purposes:

How To Find The Full Path to a File Using PHP

Trackback URL for this entry