Help with including files...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SkyDriver
Forum Newbie
Posts: 2
Joined: Sat Mar 13, 2010 1:28 am

Help with including files...

Post 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.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: Help with including files...

Post by s.dot »

I do believe you want ../../functions.php

or

$_SERVER['DOCUMENT_ROOT'] . '/forum/functions.php';
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
SkyDriver
Forum Newbie
Posts: 2
Joined: Sat Mar 13, 2010 1:28 am

Re: Help with including files...

Post by SkyDriver »

Thank you s.dot, now worked great. :)
Post Reply