i have following folder structure.
config.php
<?php
class config {
const server = "localhost";
}
conn.php
<?php
require_once './config.php';
firstExample.php
<?php
require_once './db/conn.php';
when i run conn.php there is no errors.but if i run firstExample.php i got following error
Warning: require_once(./config.php): failed to open stream: No such file or directory in C:\wamp\www\testX\db\conn.php on line 2
i do some tests and able to fix the error by changing conn.php to
require_once './db/config.php';
my question is i need to add conn.php from lot of folders,sub folders.so changing like above doesn't work.for example if i run conn.php after above change then again i'm getting same error.
what i want to know is correct way of adding files.so when i add conn.php to any file config.php should be included.
