robsim Posted April 9, 2010 Share Posted April 9, 2010 Hello, I'm having problems with including a php file into another. Suppose I have a file in a directory "down". The file that I'm trying to include is located in the directory above ("up"). So I write include("../filetoinclude.php") . The problem is that filetoinclude.php has its own includes and now thinks the files are in the "down" directory and not in the "up". Is there any workaround to this, or do I have to specify full paths to files in the filetoinclude.php? Sorry if this isn't too clear... Link to comment https://forums.phpfreaks.com/topic/198089-help-with-including-a-php-file/ Share on other sites More sharing options...
cs.punk Posted April 9, 2010 Share Posted April 9, 2010 I see what you mean... Not sure on what you can do... As last i checked you CAN't specify a full path: inculde ("/test1/1/etc.php"); Link to comment https://forums.phpfreaks.com/topic/198089-help-with-including-a-php-file/#findComment-1039365 Share on other sites More sharing options...
oni-kun Posted April 9, 2010 Share Posted April 9, 2010 I see what you mean... Not sure on what you can do... As last i checked you CAN't specify a full path: inculde ("/test1/1/etc.php"); $_SERVER['DOCUMENT_ROOT']; instead of traversing back one directory. Link to comment https://forums.phpfreaks.com/topic/198089-help-with-including-a-php-file/#findComment-1039371 Share on other sites More sharing options...
robsim Posted April 9, 2010 Author Share Posted April 9, 2010 $_SERVER['DOCUMENT_ROOT'] is a good idea, but it doesn't work for me, because I'm using a subdomain and the document root points to a folder that doesn't actually exist. Seems like I have to move all files into the same folder... :'( Link to comment https://forums.phpfreaks.com/topic/198089-help-with-including-a-php-file/#findComment-1039381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.