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?

 

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.