Failed to open stream: No such file or directory

Hello,

I’m facing a problem with include files in my php code.

i’m using my code like local code but it’s give me this erreur:

Warning : include(includes/db.php): failed to open stream: No such file or directory in /storage/ssd5/990/15014990/public_html/functions/functions.php on line 3

Warning : include(includes/db.php): failed to open stream: No such file or directory in /storage/ssd5/990/15014990/public_html/functions/functions.php on line 3

Warning : include(): Failed opening ‘includes/db.php’ for inclusion (include_path=’.:/usr/share/pear:/usr/share/php’) in /storage/ssd5/990/15014990/public_html/functions/functions.php on line 3

page: https://locationfacile.000webhostapp.com/functions/functions.php

here you are the code that i use:

include path error

i tried several path:
include(“includes/db.php”);
include("…/includes/db.php");
include("/includes/db.php");
include(“public_html/includes/db.php”);

but nothing worked form me.

do you have any idea what is the problem?

thanks

We don’t provide coding assistance, checkout https://stackoverflow.com

Seems that the file is missing though?

No such file or directory in /storage/ssd5/990/15014990/public_html/functions/functions.php on line 3

Ensure the file is correctly uploaded in the correct location and named correctly… so make sure db.php is inside includes inside public_html?

Hi infinity,

I know what the error mean.

i don’t understand why it’s not working. the same code work on local.

i tired the project in another website hosting and is working correct without any modification

Hello,

I’m guessing you’ve coded that in a Windows environment. Windows OS manages paths in a different way than UNIX does (I believe that’s up to php configuration as well). In your case the path you’re using should be ../includes/db.php because you’re searching the file one directory above within directories tree, relative to functions.php file location.

Famous frameworks prefer to use fixed paths via magical globals such as __DIR__ or via getcwd() to make sure the lookup is compatible on all platforms.

This topic was automatically closed after 23 hours. New replies are no longer allowed.