Jump to content

relative referencing doesn't work when uploading files


stijn0713

Recommended Posts

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?

 

 

 

 

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.