PDA

View Full Version : Help with includes


Hiroshimator
27 Nov 2001, 13:48
I always get errors like this when i include files from a different directory

Fatal error: Failed opening required './admin/config.php' (include_path='') in /home/win32asm/public_html/board/global.php on line 96


and it's because PHP doesn't take into account the directory according to the file i include but to the file from which i called the first include :(

How do I solution this?

Thank you very much

-H-

Chen
27 Nov 2001, 13:56
You use the chdir() function (Change Directory):


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Hiroshimator
27 Nov 2001, 14:00
ok, thx a lot :)

I'll try that.

I'm an experienced ASP and ColdFusion user but PHP is new to me.

Thx again :)

-H-

Mark Hensler
27 Nov 2001, 15:36
I prefer to change the scope of included files rather than changing directories...


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

It is important to have that colon! And there is no trailing slash.

PHP Docs: include_path (http://www.php.net/manual/en/configuration.php#ini.include-path), ini_get (http://www.php.net/manual/en/function.ini-get.php), ini_set() (http://www.php.net/manual/en/function.ini-set.php)


You can also do this in .htaccess:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------