Avatar of Robert Francis
Robert Francis

asked on 

PHP include path not working

I am creating PHP pages on a Microsoft server. Up until now all of my files have been in the root folder and accessing include files from an includes folder. I have reached the point where I need to be a little more organized. I would like to move most (not all) of my php files into folders. I have setup a couple of test files and folders to try to use include files but they are not working. Here is what I have so far:

C:\inetpub\wwwroot\portal2\time_fix\time_fix.php (PHP file)
C:\inetpub\wwwroot\portal2\inc\header.php (Include file)

This line is in my php.ini file:

include_path = "C:\inetpub\wwwroot\portal2\inc"

This is the first line of my time_fix.php:

<?php include 'header.php';?>  

This is what I get when I try to run the file:

Warning: include(header.php): failed to open stream: No such file or directory in C:\inetpub\wwwroot\portal2\time_fix\time_fix.php on line 1

Warning: include(): Failed opening 'header.php' for inclusion (include_path='C:\inetpub\wwwroot\portal2\inc') in C:\inetpub\wwwroot\portal2\time_fix\time_fix.php on line 1

What is going on?

Avatar of undefined
Last Comment

8/22/2022 - Mon