Here is my directory tree:
- /
- index.php
- include/
- functions.php
- head.php
- connect.php
- sub/
- index.php
In my head.php and connect.php both have:
include_once 'include/functions.php';
My index.php in the root folder includes these two: head.php and connect.php like this:
include_once 'include/connect.php';
include_once 'include/head.php;'
However, when my index.php in sub/ includes functions.php and head.php, they would fail to also include functions.php. Here's how I included in the sub/index.php:
include_once '../include/connect.php';
include_once '../include/head.php';
If I change in the head.php and connect.php to: include_once '../include/functions.php';
The sub/index.php would include everything normally but the index.php in the root would fail to load the functions.php.
How can I fix this?
PHP version: 5.2.*