stijn0713 Posted August 15, 2012 Share Posted August 15, 2012 Hello, I tested my script locally on wamp and now i uploaded them to my hosting and it fails to open the database connection file my files look like: dir connect file index.php --> uses require_once('/connect/db.php') I uploaded the dirs and files the same way so it the relativity in paths should stay the same . I work on windows and hosting is linux, might it have to do with that? Quote Link to comment https://forums.phpfreaks.com/topic/267143-relative-referencing-doesnt-work-when-uploading-files/ Share on other sites More sharing options...
Christian F. Posted August 15, 2012 Share Posted August 15, 2012 No, it should not. If you want a more thorough answer, you have to show us some code and (more importantly) the error messages you get. Quote Link to comment https://forums.phpfreaks.com/topic/267143-relative-referencing-doesnt-work-when-uploading-files/#findComment-1369733 Share on other sites More sharing options...
stijn0713 Posted August 16, 2012 Author Share Posted August 16, 2012 Well, i figured it out by now: i relatively referenced it like: require_once('/connect/db.php') on wamp which worked. require_once('connect/db.php') worked on hosting so WITHOUT slash in the front. I think it has to do with linux but i'm not sure. Anyway, i thought i add it, maybe for people facing the same stupid error. Quote Link to comment https://forums.phpfreaks.com/topic/267143-relative-referencing-doesnt-work-when-uploading-files/#findComment-1369759 Share on other sites More sharing options...
Christian F. Posted August 16, 2012 Share Posted August 16, 2012 Thanks for updating your post with the problem and the solution. Reason it didn't work was because of the leading slash, as you had instructed the PHP parser to look at the root folder. IE "c:\" on Windows, or "/" on Linux. Why it worked while on Windows I don't know, as it shouldn't have. Guess there are some configuration differences between the two servers, which clouded the issue. Quote Link to comment https://forums.phpfreaks.com/topic/267143-relative-referencing-doesnt-work-when-uploading-files/#findComment-1369766 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.