Phrank Posted June 5, 2008 Share Posted June 5, 2008 I have a directory structure like: root ---> somepages ---> someincludes I have a webpage 'somepages\mypage.php' and in that page I have an include "..\someincludes\abcinlcude.php" This works for some isp's. the ..\ take me back to the root. For other isp's it takes me too far back like 'user\blah\blah\root' and of course the "..\someincludes" fails. How do you get around this? Any help would be greatly appreciated. TIA Link to comment https://forums.phpfreaks.com/topic/108829-backing-up-to-the-root-with-does-not-work-on-some-isps-what-do-you-use/ Share on other sites More sharing options...
Xurion Posted June 5, 2008 Share Posted June 5, 2008 Sounds more like a restriction from your ISP so I doubt you'll be able to get around it. You should probably ask their tech support. Link to comment https://forums.phpfreaks.com/topic/108829-backing-up-to-the-root-with-does-not-work-on-some-isps-what-do-you-use/#findComment-558233 Share on other sites More sharing options...
craygo Posted June 5, 2008 Share Posted June 5, 2008 "../" as it should be will take you back one level. If you do not use the .. you will start from the actual root of you host as you described below. so "../someincludes/abcinclude.php" will go back one level "/someincludes/abcinclude.php' will look for the folder "someincludes" in the actual root directory not the root of the web when working with paths in html always use forward slash "/" even on a windows box it will be fine. Ray Link to comment https://forums.phpfreaks.com/topic/108829-backing-up-to-the-root-with-does-not-work-on-some-isps-what-do-you-use/#findComment-558237 Share on other sites More sharing options...
PFMaBiSmAd Posted June 5, 2008 Share Posted June 5, 2008 Leading ./ or ../ are relative to the CWD (current working directory) in an include() (according to the manual.) The CWD is one of those gray undocumented areas where you don't really know what it could be depending on how your script was reached (directly or being included by another file...) I recommend forming absolute file system paths using $_SERVER['DOCUMENT_ROOT'] include($_SERVER['DOCUMENT_ROOT'] . '/your_path/your_file.php'); This will work independently of any CWD value or any include_path settings or differences between servers. Link to comment https://forums.phpfreaks.com/topic/108829-backing-up-to-the-root-with-does-not-work-on-some-isps-what-do-you-use/#findComment-558278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.