Reputation: 37
How to find the address of the server that contains the files?
for example:
/home/hosting/helloworld/public_html/
Is it possible to print it with PHP
?
Upvotes: 0
Views: 66
Reputation: 10717
Use dirname
your root index.php
file.
echo dirname(__FILE__);
Or in PHP 5.3+
echo __DIR__;
Upvotes: 1
Reputation: 17380
Also if you pass a filename you can use this one:
echo realpath("sample.php");
in my case it prints:
D:\Hosting\232325443\html\sample.php
Upvotes: 0
Reputation: 2364
This will get current server path.
echo getcwd();
http://php.net/manual/en/function.getcwd.php
Upvotes: 0