Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: php include

  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php include

    Hi, have alittle problem with the includes.

    - I have a forum, phpbb.
    - And lets say an empty .php file

    I want to include the forum in the php file, the forum is located, from the root in "/forum/index.php"

    And in the php file ive used what my friends say would work.
    PHP Code:
    <? include "forum/index.php"?>
    But, it didnt work, but if i include only, i.e
    PHP Code:
    <? include "testpage.php"?>
    then it works, so its probbaly the folder thats the problem

    The errors;

    Warning: main(./extension.inc) [function.main]: failed to open stream: No such file or directory in /****/****/****/****/www-root/forum/index.php on line 25

    Warning: main() [function.include]: Failed opening './extension.inc' for inclusion (include_path='.:') in /****/****/****/****/www-root/forum/index.php on line 25

    Warning: main(./common.) [function.main]: failed to open stream: No such file or directory in /****/****/****/****/www-root/forum/index.php on line 26

    Warning: main() [function.include]: Failed opening './common.' for inclusion (include_path='.:') in /****/****/****/****/www-root/forum/index.php on line 26

    Fatal error: Call to undefined function session_pagestart() in /****/****/****/****/www-root/forum/index.php on line 31
    ..so what do to

  • #2
    Senior Coder JamieR's Avatar
    Join Date
    Oct 2004
    Location
    United Kingdom
    Posts
    3,161
    Thanks
    0
    Thanked 5 Times in 5 Posts
    tried putting a absolute path such as:

    PHP Code:
    <?php include("http://www.yoursite.com/forum/index.php"); ?>
    ?
    Also you're missing the () of the include function

  • #3
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    Quote Originally Posted by unknownx
    And lets say an empty .php file
    where? that's the issue. if the file that is calling the include is in the document root of your site then you can simply do:
    PHP Code:
    <?php include('./forum/index.php'); ?>
    if the file is elsewhere then you have to specify the absolute path or do:
    PHP Code:
    <?php include($_SERVER['DOCUMENT_ROOT'] . '/forum/index.php'); ?>

  • #4
    Regular Coder
    Join Date
    Apr 2004
    Posts
    684
    Thanks
    24
    Thanked 1 Time in 1 Post
    You are having problems because you included a file that has other includes in it which may be relative to the directory it is in; since you're including it back a directory that is why you are having issues.

  • #5
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ive tried all of that, dosnt work.. just decreased the errors:

    Warning: main(http://www.****.com/forum/index.php) [function.main]: failed to open stream: Permission denied in /****/****/****/****//www-root/phpbb.php on line 98

    Warning: main() [function.include]: Failed opening 'http://www.****.com/forum/index.php' for inclusion (include_path='.:') in /****/****/****/****/www-root/phpbb.php on line 98
    And on line 98 is the include stuff you posted.

    @devinemke:

    yes the empty.php is in the root, like
    www-root/empty.php
    www-root/forum/index.php


    Could it be the servers that bothers?


    Quote Originally Posted by cyphix
    You are having problems because you included a file that has other includes in it which may be relative to the directory it is in; since you're including it back a directory that is why you are having issues.
    hmm k.. anything i can do about it?

    *
    I tried putting an empty2.php in root/forum/empty2.php

    and in root/empty.php i included;
    PHP Code:
    <?php include("http://www.****.com/forum/empty2.php"); ?>
    and the empty2.php had no includes in it, got same errors
    Last edited by unknownx; 09-25-2005 at 03:17 PM.

  • #6
    Regular Coder
    Join Date
    Apr 2004
    Posts
    684
    Thanks
    24
    Thanked 1 Time in 1 Post
    Well you could try setting your "$phpbb_root_path" root path (I think you're using phpBB right?) to any files that set it to your absoloute path to the actual location of the forum root dir...... but; I'm not exactly sure if you can do that without screwing anything else up.. best to ask @ phpbb.com support forums.

  • #7
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by cyphix
    Well you could try setting your "$phpbb_root_path" root path (I think you're using phpBB right?) to any files that set it to your absoloute path to the actual location of the forum root dir...... but; I'm not exactly sure if you can do that without screwing anything else up.. best to ask @ phpbb.com support forums.

    alright ill try that tnx

  • #8
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by weazel
    Also you're missing the () of the include function

    Include and require (along with their _once counterparts) are NOT functions. They are command structures. No ()'s are needed.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •