jordz Posted March 1, 2010 Share Posted March 1, 2010 Okay so my directory is structured like this /beta/ contains config.php among other files. Every time I require or include it I get an error corresponding to this: Warning: require_once(/config.php) [function.require-once]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/beta/dbeditor/index.php on line 5 Fatal error: require_once() [function.require]: Failed opening required '/config.php' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/beta/dbeditor/index.php on line 5 I've tried modify my code like so: require('config.php'); require('./config.php'); require('/config.php'); still nothing, Ive looked around the web and can't find anywhere that explains this enough for me to understand let alone how to fix it. The current directory im working in is /beta/dbeditor/ anyway but nothing in /beta works either. Please, any help would be greatly appreciated. Jordan Link to comment https://forums.phpfreaks.com/topic/193791-includes-and-requires-dont-seem-to-be-working-is-it-my-code/ Share on other sites More sharing options...
inversesoft123 Posted March 1, 2010 Share Posted March 1, 2010 include($_SERVER['DOCUMENT_ROOT'].'/beta/config.php'); Link to comment https://forums.phpfreaks.com/topic/193791-includes-and-requires-dont-seem-to-be-working-is-it-my-code/#findComment-1019987 Share on other sites More sharing options...
jordz Posted March 1, 2010 Author Share Posted March 1, 2010 You really have been a massive help inversesoft123 you're absolutley awesome, thanks so much! Jordan :D Link to comment https://forums.phpfreaks.com/topic/193791-includes-and-requires-dont-seem-to-be-working-is-it-my-code/#findComment-1020003 Share on other sites More sharing options...
inversesoft123 Posted March 1, 2010 Share Posted March 1, 2010 You really have been a massive help inversesoft123 you're absolutley awesome, thanks so much! Jordan :D welcome bud that was a real big thanks lol. care to mark it solved ) Link to comment https://forums.phpfreaks.com/topic/193791-includes-and-requires-dont-seem-to-be-working-is-it-my-code/#findComment-1020006 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.