christo16 Posted April 24, 2008 Share Posted April 24, 2008 I have a php file (call it file 1) that includes two other files (call them file 2 + 3). The file with the two other files I am including on other different pages, its for site statistics. But when I include file 1 to another page, it produces errors not able to find file 2 + 3. I understand that it doesn't know where to find them because I used relative paths for file 2 + 3 in file 1. Whats the best way to fix this problem? Thanks! Link to comment https://forums.phpfreaks.com/topic/102660-include-problem/ Share on other sites More sharing options...
mrdamien Posted April 24, 2008 Share Posted April 24, 2008 Use an absolute path: include ($_SERVER['DOCUMENT_ROOT'] . "/path/to/your/site/includes/file2.php"); include ($_SERVER['DOCUMENT_ROOT'] . "/path/to/your/site/includes/file3.php"); Should work no matter where you include it form. Link to comment https://forums.phpfreaks.com/topic/102660-include-problem/#findComment-525786 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.