csjumper Posted August 26, 2010 Share Posted August 26, 2010 Hello am new to php and am working with a config file. But it always give me a wrong path to file /homedomains/xxxxx/public_html/ no / between home an domains.. am frustrated on how to solve this... plz help me in this an attaching the script file.. config file too [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/211764-hello-am-always-getting-the-wrong-path-to-file/ Share on other sites More sharing options...
csjumper Posted August 26, 2010 Author Share Posted August 26, 2010 the original path it should get is /home/admin/domains/xxxxx/public_html/ but its getting /homedomains/xxxxx/public_html/ so its missing a whole /admin/ from path....... Link to comment https://forums.phpfreaks.com/topic/211764-hello-am-always-getting-the-wrong-path-to-file/#findComment-1103860 Share on other sites More sharing options...
tcsoftware Posted August 26, 2010 Share Posted August 26, 2010 You can use $_SERVER['DOCUMENT_ROOT'] to get the path to the root of your website Link to comment https://forums.phpfreaks.com/topic/211764-hello-am-always-getting-the-wrong-path-to-file/#findComment-1103861 Share on other sites More sharing options...
csjumper Posted August 26, 2010 Author Share Posted August 26, 2010 originally the one used is $_SERVER["SCRIPT_NAME"] bcz its a part of a big script so changing this function might cause some problems.. can u plz look at the file attached bcz i was thinking that some thing might be wrong with it...which is causing such a problem... i can,t figure out why /admin/ is missing from the path... /home/admin/domains/xxxxx/public_html/ but its getting /homedomains/xxxxx/public_html/ it getting the path but its wrong :|.. Link to comment https://forums.phpfreaks.com/topic/211764-hello-am-always-getting-the-wrong-path-to-file/#findComment-1103863 Share on other sites More sharing options...
tcsoftware Posted August 27, 2010 Share Posted August 27, 2010 I can't give you line numbers as the copy of the file I downloaded was wrapped at 80 characters and a little difficult to read However str_replace is used at least 3 times in there to remove /admin/, /members/, /cron/, etc... from URL's that it appears to be building. Link to comment https://forums.phpfreaks.com/topic/211764-hello-am-always-getting-the-wrong-path-to-file/#findComment-1104342 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.