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. Link to comment https://forums.phpfreaks.com/topic/223146-help/ 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. Link to comment https://forums.phpfreaks.com/topic/223146-help/#findComment-1153584 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. Link to comment https://forums.phpfreaks.com/topic/223146-help/#findComment-1153590 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? Link to comment https://forums.phpfreaks.com/topic/223146-help/#findComment-1153591 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. Link to comment https://forums.phpfreaks.com/topic/223146-help/#findComment-1153593 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) Link to comment https://forums.phpfreaks.com/topic/223146-help/#findComment-1153598 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.