so i playing around with php and im having a problem... Im trying to access the folder 'includes' from my main directory using include ('/includes/header.php'); PHP: which returns the error Warning: include(/includes/header.php) [function.include]: failed to open stream: No such file or directory in /home/cp/public_html/j7/bt/index.php on line 3 Warning: include() [function.include]: Failed opening '/includes/header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/j7/public_html/cp/bt/index.php on line 3 Code (markup): now when i access the 'includes' files from another folder, like so include ('../includes/header.php'); PHP: it works just fine and things are happy can anyone tell me what the problem could be? Is there a fix for accessesing lower level folders with includes? i've also tried removing the "/" to make include ('includes/header.php'); PHP: that returns no error but doesn't render correctly
*louie* is correct. When you try to pull up the include file as you did in a subfolder 'it' will expect the includes directory to be within that subfolder
Try this out. set_include_path('includes'); include 'header.php'; PHP: Should work from any subdirectory