Pyro4816 Posted January 1, 2011 Share Posted January 1, 2011 I'm pretty sure this has been answered, and it is just general knowledge that obviously i do not have. I just moved to a server, and all of my pages using ../ to go back a directory are erroring out: saying the file doesn't exist. I know it exists, but unless I use the full exact web address, it will not function properly. Any ideas? Is there a setting in php or on the server to enable this?? Again sorry to ask here, but searching the forum for ../ is almost as useful as searching for the letter a, and Google.... well you get the idea. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 1, 2011 Share Posted January 1, 2011 ../ is a relative path that means "go up one directory". if the files are not up one directory, you'll need to adjust the path. Quote Link to comment Share on other sites More sharing options...
Pyro4816 Posted January 1, 2011 Author Share Posted January 1, 2011 The problem is the files ARE up one directory, i just don't know why it wont recognize it. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 1, 2011 Share Posted January 1, 2011 can we see the code and the error message? Quote Link to comment Share on other sites More sharing options...
Pyro4816 Posted January 1, 2011 Author Share Posted January 1, 2011 Error: Warning: require_once(../includes/DbConnector.php) [function.require-once]: failed to open stream: No such file or directory in /home/pyro4816/public_html/Instal/instal3.php on line 9 line 8 and 9 <?PHP require_once('../includes/DbConnector.php'); All the files are in the proper place, its just that the ../ isnt working properly on the server for some reason. Quote Link to comment Share on other sites More sharing options...
BLaZuRE Posted January 1, 2011 Share Posted January 1, 2011 Relative paths don't work the same way in PHP as they do in other languages. Paths are tracked at runtime and are not relative to the executing script. You can add and concatenate dirname(__FILE__) to your path instead in front of ../ Edit: mistyped. You still need to change directories. Anyway, I forgot about the new constant: __DIR__ which is the same as the code given above (php 5.3+ only) Quote Link to comment 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.