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! Quote 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. Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.