Fender963 Posted December 5, 2006 Share Posted December 5, 2006 I am having trouble getting this to work.Say i have index.php which is located in public_html/files/extras/index.phpand then I have a file i wish to include which is in public_html/includes/variables.phpI can't simply do a call [code]include 'directory/file.php';[/code]because the directory is "behind" the current directory.but when I do[code]include ("http://www.mydomain.com/includes/variables.php");[/code]I can't access the variables for the reason explained in this thread I found while searching for an answer:http://www.phpfreaks.com/forums/index.php/topic,108540.0.htmlIs there a workaround?- Kyle Link to comment https://forums.phpfreaks.com/topic/29490-include-file-from-previous-directory/ Share on other sites More sharing options...
mansuang Posted December 5, 2006 Share Posted December 5, 2006 Try[code]include("../../includes/variables.php");[/code]"../" means one parent directory.Mansuang Link to comment https://forums.phpfreaks.com/topic/29490-include-file-from-previous-directory/#findComment-135330 Share on other sites More sharing options...
JasonLewis Posted December 5, 2006 Share Posted December 5, 2006 or include the full path, /home/user/public_html/includes/variables.phpthat is a good way to do it Link to comment https://forums.phpfreaks.com/topic/29490-include-file-from-previous-directory/#findComment-135341 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.