Sunday, December 25, 2011

How to find absolute path on a web-server (using PHP)


When using PHP, the simplest way to find the absolute path of your files/folders on the server is by creating a simple path.php file with the following contents:
PLAIN TEXT
PHP:
echo realpath(dirname(__FILE__));
?>
Put the new file anywhere in the web-accessible folder on your server,
then just access that file from your favourite web-browser - and you'll have the absolute path shown to you.
Alternatively, you may use the following code:
PLAIN TEXT
PHP:
echo getcwd();
?>
This also should display the absolute path on your server.
Source: http://bogdan.org.ua/2007/04/30/how-to-find-absolute-path-on-a-web-server-using-php.html
comments