troubleshooting Question

PHP include path not working

Avatar of Robert Francis
Robert Francis asked on
6 Comments1 Solution162 ViewsLast Modified:
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?
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros