sachavdk Posted August 12, 2007 Share Posted August 12, 2007 Hi, I'm having a problem here that confuses me a little. I'm working on http://157.176.112.4/site/en-uk/read-guestbook/index.php and I'd like to require http://157.176.112.4/inc/ModuleLoader.php but using require_once( "/inc/ModuleLoader.php" ); gives me an error: PHP Warning: main(/inc/site.php) [function.main]: failed to open stream: No such file or directory in J:\WEBSERVER\www\beta\site\en-uk\read-guestbook\index.php on line 2 PHP Fatal error: main() [function.require]: Failed opening required '/inc/site.php' (include_path='.;C:\php5\pear') in J:\WEBSERVER\www\beta\site\en-uk\read-guestbook\index.php on line 2 file_exists( "/inc/ModuleLoader.php" ); fails as well. using require_once( "../../../inc/ModuleLoader.php" ); does work. any suggestions? thanks edit: I can't use relative paths because the structure of the <site> class isn't really written to deal with this. Link to comment https://forums.phpfreaks.com/topic/64577-solved-requiring-files-using-absolute-path/ Share on other sites More sharing options...
teng84 Posted August 12, 2007 Share Posted August 12, 2007 to obtain this you may need a site ini in each folder site ini is were you define the location of each folder or include you need Link to comment https://forums.phpfreaks.com/topic/64577-solved-requiring-files-using-absolute-path/#findComment-321912 Share on other sites More sharing options...
sachavdk Posted August 12, 2007 Author Share Posted August 12, 2007 Which variable(s) should I set in there? Because there are a lot of them it seems. Link to comment https://forums.phpfreaks.com/topic/64577-solved-requiring-files-using-absolute-path/#findComment-321915 Share on other sites More sharing options...
teng84 Posted August 12, 2007 Share Posted August 12, 2007 i dont know it your work so its hard to tell but in each folder you have to define the path that need to be include in every page you said this works using require_once( "../../../inc/ModuleLoader.php" ); does work. then define them define it like define('folder1', "../../../inc/" ); now you can use folder1 to determine the location you need Link to comment https://forums.phpfreaks.com/topic/64577-solved-requiring-files-using-absolute-path/#findComment-321917 Share on other sites More sharing options...
sachavdk Posted August 12, 2007 Author Share Posted August 12, 2007 Oh yeah That'll do fine I guess... Link to comment https://forums.phpfreaks.com/topic/64577-solved-requiring-files-using-absolute-path/#findComment-321921 Share on other sites More sharing options...
teng84 Posted August 12, 2007 Share Posted August 12, 2007 that is what actually the usual design of a site having lots of subsite i guess time to mark this solved Link to comment https://forums.phpfreaks.com/topic/64577-solved-requiring-files-using-absolute-path/#findComment-321923 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.