failed to open stream: No such file or directory


Apr 20, 2020
United States
cPanel Access Level
Website Owner
I've been trying to move my website to cpanel and none of the pathways are working when I use "include" in php. Whenever I run the website in localhost through iis or in php's built in local host the exact same file that I'm using in cpanel works.

My errors look like this:

Warning: include(pageContent/header.html): failed to open stream: No such file or directory in /home/<User>/public_html/index.php on line 40

What I've tried includes:

1.Sticking the file in the same dir as the page which works. However I can't do that because some of the code depends on the structure of the files.

2.Moving the page I'm on to be before the document I'm "including" and not using "../" anymore. This did not work.

I'm thinking it is a settings option but I wouldn't know where to find that since this is my first time making a website. Additionally I assume "../" still moves the directory back by one level.

(I started programming last month so please be extra clear with your answers. Thank you)


Product Owner II
Staff member
Nov 14, 2017
Without knowing anything about the file structure, it'd be hard to tell you what the issue is specifically. You might want to look at the following though: