SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist ashattuc's Avatar
    Join Date
    Aug 2002
    Location
    Boise, Idaho
    Posts
    411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Include Problem

    Hello,

    I have a script that needs to include a file either absolutely like this:

    /folder/includes/myfile.php

    Or relitively, like this:
    ../folder/includes/myfile.php

    However, it seems that the way the include directive is set, I get this error:

    Code:
    Warning: main(../folder/includes/ibd_query.php): failed to open stream: No such file or directory in /home/[mydirectory]/includes/application_top.php on line 4
    It looks like since there is a "/includes" in the include that it's looking for the file in the default includes folder. I want it NOT to look in there, but to look exactly where I'm asking it to look.

    Is there a way to do this?

    Thank you,
    Chris S.
    Chris S.

    Free Web Scripts - Form generators, AJAX tools and more!
    Micro CMS - A totally free AJAX-based, SEO-ed CMS!

  2. #2
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use absolute path, and this error should go away.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  3. #3
    Non-Member St.'s Avatar
    Join Date
    Nov 2004
    Location
    Cloud #9
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when you type /folder, you mean directory in root folder
    but when you type ../folder you point to /home/[mydirectory]/folder directory

  4. #4
    SitePoint Member baburaj's Avatar
    Join Date
    Sep 2004
    Location
    india
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You must finclude file path is


    include ="folder/< file name >";
    Arbe

  5. #5
    SitePoint Addict DA Master's Avatar
    Join Date
    Apr 2004
    Location
    /etc/php.ini
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I usually use this code...

    PHP Code:
    include("{$_SERVER['DOCUMENT_ROOT']}/folder/file.php"); 


Bookmarks

Posting Permissions

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