topcoder1 Posted August 28, 2007 Share Posted August 28, 2007 I have 3 files Index.php, x.php and login/Login.php in Login.php <?php require_once "../x.php"; ?> Index.php <?php require_once "login\Login.php"; ?> when executing Index.php error is Failed opening required '../x.php' I can of course say <?php require_once "x.php" ?> in Login.php, then Index.php would load fine.. However if I load login\Login.php independently, x.php would not be found. So what should I do? Link to comment https://forums.phpfreaks.com/topic/67128-includes/ Share on other sites More sharing options...
trq Posted August 28, 2007 Share Posted August 28, 2007 Best to use absolute paths, you can use $_SERVER['DOCUMENT_ROOT'] as a starting point. Link to comment https://forums.phpfreaks.com/topic/67128-includes/#findComment-336688 Share on other sites More sharing options...
topcoder1 Posted August 28, 2007 Author Share Posted August 28, 2007 Best to use absolute paths, you can use $_SERVER['DOCUMENT_ROOT'] as a starting point. thanks but if I create a config.php that sets my app file root, then I need to include that config.php as well... this problem becomes circular.. might as well put everything under the app root... there has to be a simple solution right? I searched for a while and not able to find one... Link to comment https://forums.phpfreaks.com/topic/67128-includes/#findComment-336773 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.