I have the following files structure:
temp
main
index.php
a.php
b.php
Here are the files;
index.php
echo "index.php ---> " . __DIR__ . "<br />";
require('../a.php');
echo "OK<br />"
a.php
echo "a.php ---> " . __DIR__ . "<br />";
require('./b.php');
echo "a is here<br />"
b.php
echo "b is here<br />"
When index.php
is called I got the following error:
index.php ---> D:\Programs\WampServer 2\www\temp\main
a.php ---> D:\Programs\WampServer 2\www\temp
Warning: require(./b.php) [function.require]: failed to open stream: No such file or directory in D:\Programs\WampServer 2\www\temp\a.php on line 5
Fatal error: require() [function.require]: Failed opening required './b.php' (include_path='.;C:\php5\pear') in D:\Programs\WampServer 2\www\temp\a.php on line 5
I have noticed that if I change
require('./b.php');
to
require('b.php');
Why is that ? it works as expected.