Danny620 Posted February 9, 2011 Share Posted February 9, 2011 Hi i call $_SERVER['DOCUMENT_ROOT'] which returns C:/xampp/htdocs how would i make it return C:/xampp/ instead? Quote Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/ Share on other sites More sharing options...
trq Posted February 9, 2011 Share Posted February 9, 2011 Move your server root to C:/xampp/ Quote Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/#findComment-1172062 Share on other sites More sharing options...
Danny620 Posted February 9, 2011 Author Share Posted February 9, 2011 I dont really want to do that all i really want to do is return C:/xampp/htdocs using $_SERVER['DOCUMENT_ROOT'] and take that last bit off htdocs Quote Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/#findComment-1172066 Share on other sites More sharing options...
trq Posted February 9, 2011 Share Posted February 9, 2011 That's not what you asked. $_SERVER['DOCUMENT_ROOT'] . '/../'; Should achieve what you are after. Quote Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/#findComment-1172068 Share on other sites More sharing options...
Danny620 Posted February 9, 2011 Author Share Posted February 9, 2011 that just adds C:/xampp/htdocs/../ all i want is C:/xampp/ so i can create a folder like C:/xampp/private_html/ Quote Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/#findComment-1172083 Share on other sites More sharing options...
Danny620 Posted February 10, 2011 Author Share Posted February 10, 2011 anyone please? Quote Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/#findComment-1172092 Share on other sites More sharing options...
BlueSkyIS Posted February 10, 2011 Share Posted February 10, 2011 maybe. $sr = $_SERVER['DOCUMENT_ROOT']; $sr_base = rtrim($sr, 'htdocs'); echo $sr_base; Quote Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/#findComment-1172094 Share on other sites More sharing options...
trq Posted February 10, 2011 Share Posted February 10, 2011 that just adds C:/xampp/htdocs/../ all i want is C:/xampp/ so i can create a folder like C:/xampp/private_html/ mkdir($_SERVER['DOCUMENT_ROOT'] . '/../private_html'); Quote Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/#findComment-1172143 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.