10.01.2010

Find the Server Path Using PHP

There are some instances where you may need to get your absolute server path to get your website to work. I've come across this need many times, including for CMS directory path definitions and .htaccess directory definitions.


If your site is coded using PHP, you can find the server path with PHP of any page on your site by placing the following code at the top of the page :


<?php echo $file=$_SERVER['DOCUMENT_ROOT']; ?>



This bit of code will spit out something like this ; /www/sites/sitename, where "www" is the root directory of the server, "sites" is the root directory of all of your sites, and "sitename" is the root directory of the current site your're working on. You can use this technique to find the absolute server path of any page of your website.


Related Posts :
How to Install XAMPP and Expression Engine 1.6.8 (MAC)
5 Tips To Help You Choose Your CMS
Leave Comment
Name :


Email :


Location :


URL :

Remember my personal information
Notify me of follow-up comments?

Please enter the word you see in the image below:


Comment made by : bityteleunime on October 22, 2011

<a ><img>http://s005.radikal.ru/i211/1110/27/2c96301f464b.jpg</img>         
<img>http://s017.radikal.ru/i437/1110/e5/7bd39de638fe.jpg</img>         
<img>http://s017.radikal.ru/i444/1110/dd/0f3eaacc6918.jpg</img></a>       
       
Tegs: конструктор лего Racers Род Райдер lego 8302 конструктор лего Star Wars Турбо танк клонов lego 8098   Lego Star Wars Geonosian Starfighter™ Звёздный истребитель Джеонозианцев 7959.       
       
<u>детские игрушки конструкторы лего </u>         
конструкторы лего продажа          
лего совместимые конструкторы    
<a >конструктор лего star wars звездный истребитель мейса винду lego 7868</a>

Comment made by : business reputation management on July 02, 2011

I can only access the frontend application and the server name, how can i find how the data is gathered from other servers which is displayed to me, as I want to understand the flow of data from different applications.

Comment made by : Criminal Lawyer Toronto on June 19, 2011

It connects to a user account, it works. but because of the echo.. then an error message comes out. Warning: Cannot modify header information - headers already sent by (output started at… if I eliminate the echo, no session variable working(doesn’t work), if i put the same echo anywhere else it doesnt work. what’s wrong with these ?? i can’t seem to find a solution. Please help.Criminal Lawyer Toronto

Next Article Previous Article