Hi All

I have a PHP application where I use the require_once method. The problem I have is getting it to work using a relative directory structure. Everything seemed fine until I required to include a file higher up my directory structure using the following syntax:

require_once("../client/include/config.php");

this fails with "failed to open stream" error, and infact when using the PhpED immediate window no combination of ../../'s works, the only thing I managed to get to work was an absolute path from the c: prompt!

Can anyone shed any light on what I could be doing wrong?

Thanks in advance

Andy

    Found the answer on another thread in this forum, apparently its a bug within PHP and the following fixed my problem:

    require_once(dirname(FILE).'/../conf/setup.conf.php');

    sorted!

    thanks for looking though 😉

      Write a Reply...