Page 1 of 1

Help with including files...

Posted: Sat Mar 13, 2010 1:40 am
by SkyDriver
Hello friends, this is my first post and I want to say Hello to all :)

So, I have problem with including the file...
The "forums.php" is in the C:\wamp\www\forum\include
The "functions.php" is in the C:\wamp\www\forum

And now, I want to include "functions.php" into "forums.php" but I got the warning message:
Warning: include(../functions.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\forum\include\forums.php on line 9

Warning: include() [function.include]: Failed opening '../functions.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\forum\include\forums.php on line 9
forums.php

Code: Select all

 
<?php
    
    if(!defined("FORUM"))
    {
        exit;
    }
    
    include("../functions.php");
...
 
I'm fairly new to PHP programming, but I don't know where I wrong...
Please help me, thanks.

Re: Help with including files...

Posted: Sat Mar 13, 2010 1:58 am
by s.dot
I do believe you want ../../functions.php

or

$_SERVER['DOCUMENT_ROOT'] . '/forum/functions.php';

Re: Help with including files...

Posted: Sat Mar 13, 2010 2:19 am
by SkyDriver
Thank you s.dot, now worked great. :)