Martin
Martin

Reputation: 485

Pages does not find my PHP includes

I am having an include folder with haeder.inc.php, nav.inc.php and footer.inc.php.

So, I do want to organize my php pages by sections.

I mean, I do want to have a pic folder, then a video folder and put inside all php pages related to each folder.

Problems The php pages does not find my include folder (haeder.inc.php, nav.inc.php and footer.inc.php.)

I hope it makes sense.

Upvotes: 0

Views: 80

Answers (3)

Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29985

Specify full path by using a relative one like this:

require_once(dirname(__FILE__).'/../file.php');

or if your php version allows:

require_once(__DIR__.'/../file.php');

Both constructions include a file which path is provided relative to the current one.

Upvotes: 0

Luca Rocchi
Luca Rocchi

Reputation: 6464

are you using relative path ? if yes doublecheck about what your current dir is or try using absolute path

Upvotes: 1

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798606

Specify the full path instead of just the filename, e.g. ./header.inc.php.

Upvotes: 1

Related Questions