Php include not working anymore


I had below include working, now I switched to https:// I not understand why my simple coding is not working anymore

The file I want to load by using ‘include’ is a .txt file

<div id="topnavigation">
//Add the navigation
include ('');

Probably it is some small issue. I also tried include (‘,/folder1/folder2/files/information.txt’)

Thanks for the help

So you only changed http to https?

Which php version are you on?

7.4 I see

In my editor I see the coding as above, only when I open the page and rightclick and select source, I not see any of my include coding.

maybe this info helps

Do remember that PHP is a server-side language. Meaning your include code, and anything written in PHP, is not going to be seen on the page in the page source. You request a PHP page, it goes to the server, executes the PHP code, returns HTML which is then sent back to the user. No PHP is ever seen by the end user.

Just for clarification. :slight_smile:

So the page in question is being rendered in the SAME https environment as the path to the information.txt file, correct? i.e. Everything is in

If you know the relation of the page calling the file then I would use a relative path.
Note: parentheses not required.

include 'folder1/folder2/files/information.txt';

Also where https points to is a server setting… I mean I once had a site that had a directory called SSLFiles and this is where pointed to.
ALSO just using a leading / on a path does not always mean it is pointing to your domain. It depends on the environment and how things are set up. I almost always use a relative path like shown above assuming mypage.php is in the same directory as the folder folder1 in this example.

Thank you all for your replies and remarks, It made me search server side, and enable inlude_url in web server configuration. After some time the includes starts working.

Again thanks for the help.


Great! Thanks for getting back to us :+1:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.