physaux Posted November 9, 2009 Share Posted November 9, 2009 I am creating a file that will be "included" in many places. How can I refer to the site root, so that I can effectively navigate to my desired paths with fwrite()? Is there any way to do this other than "www.mysite.com" will that work? thanks! Link to comment https://forums.phpfreaks.com/topic/180877-solved-how-to-refer-to-root-directory-specific-directory-from-random-locations/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 9, 2009 Share Posted November 9, 2009 $_SERVER['DOCUMENT_ROOT'] will contain the file system path to your document root folder. You can then concatenate any path or file within your document root folder to that to come up with the absolute file system path to that folder or file. Link to comment https://forums.phpfreaks.com/topic/180877-solved-how-to-refer-to-root-directory-specific-directory-from-random-locations/#findComment-954191 Share on other sites More sharing options...
physaux Posted November 9, 2009 Author Share Posted November 9, 2009 And is $_SERVER['DOCUMENT_ROOT'] the root of the public html, or the main root? Edit: Nevermind, I got it Link to comment https://forums.phpfreaks.com/topic/180877-solved-how-to-refer-to-root-directory-specific-directory-from-random-locations/#findComment-954193 Share on other sites More sharing options...
PFMaBiSmAd Posted November 9, 2009 Share Posted November 9, 2009 How about echoing it to see what it contains. Link to comment https://forums.phpfreaks.com/topic/180877-solved-how-to-refer-to-root-directory-specific-directory-from-random-locations/#findComment-954199 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.