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? 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/ 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 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. 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/ 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? 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; 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'); Link to comment https://forums.phpfreaks.com/topic/227220-_serverdocument_root/#findComment-1172143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.