1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

failed to open stream: No such file or directory.. need help..

Discussion in 'PHP' started by FR3@K, Oct 7, 2007.

  1. #1
    look at my index.php , its in root folder.

    <?php include("inc/header.php"); ?>
    Code (markup):
    in my header.php , its in "inc" folder

    <?php include("/inc/menu_top.php"); ?>
    Code (markup):

    menu_top.php is located in "inc" folder .


    but when i open index.php , it gives this error

    could someone tell me whats wrong with it??
     
    FR3@K, Oct 7, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    <?php include("inc/menu_top.php"); ?>
    
    PHP:
    Don't use relative paths.
     
    nico_swd, Oct 7, 2007 IP
  3. FR3@K

    FR3@K Banned

    Messages:
    182
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ok i made it :

    <?php include("inc/menu_top.php"); ?>


    but it is still not working.. still giving same error.. :(
     
    FR3@K, Oct 7, 2007 IP
  4. james_r

    james_r Peon

    Messages:
    194
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I see. Try this:

    <?php include("menu_top.php"); ?>
     
    james_r, Oct 7, 2007 IP
  5. FR3@K

    FR3@K Banned

    Messages:
    182
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ooooooppppppssssss ......


    so sorry nico_swd..
    your code worked..
    i just had to rename the file to menu_top.php , actually i renamed it to nav_top.php earlier to test other files..
    and i forgot to rename it back to menu_top.php.

    thanks nico_swd u are right i just needed to remove the slash from code..
    I really appreciate that u help me..
    i want to give +rep but it is saying " please spread some reputation around before giving it to nico_swd again."
    so.. the only thing i can give u is thanks. :)
     
    FR3@K, Oct 7, 2007 IP
  6. rautashoka

    rautashoka Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Sometimes your invalid include path in the php.ini can be a cause to the error you have mentioned.
    If so, then first identify your Loaded Configuration File and change
    include_path = ".;C:\xampp\php\PEAR;"
    to
    include_path = ".;C:\xampp\php\PEAR;C:\applicationFolder;C:\applicationFolder\conf"
    And restart your apache and refresh the page.
     
    rautashoka, Apr 11, 2012 IP
  7. tosinakinsowon

    tosinakinsowon Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Warning:include(./includes/footer.inc.php) [function.include] : failed to open the stream : No such file or directory in C:xampp\htdocs\phpsols\contact.php on line 270

    Pls I need solution to this bug
     
    tosinakinsowon, Dec 6, 2012 IP
  8. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #8
    The question is, do you understand WHY James' solution worked?

    From the viewpoint of a file in inc, a file in inc isn't in inc, it's in the current directory. inc/header.php would only work if you had /home/bilalgho/public_html/inc/inc/header.php
     
    Rukbat, Dec 6, 2012 IP
  9. tosinakinsowon

    tosinakinsowon Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Ive try fixing d bug
    Still giving me d same error
     
    tosinakinsowon, Dec 6, 2012 IP
  10. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #10
    Go to your site. You can use CPanel's file functions or you can use an FTP program. Look in /home/bilalgho/public_html/inc (You may only be able to get to public_html, not to /home/bilalgho/public_html. That's okay. Just go to inc from there.

    Is there a file in there named header.php? menu_top.php says there is. If it's not there, you have a missing (or misplaced) file.
     
    Rukbat, Dec 6, 2012 IP
  11. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #11
    You're just going to have to find out where header.php actually is, then change the code to point to that location. No one can tell you where it is without access to your site. (It's also possible, but not very likely, that the file has no permissions, so it can't be read, or it's defective.)
     
    Rukbat, Dec 7, 2012 IP
  12. ogah

    ogah Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #12
    <?php include("./inc/menu_top.php"); ?>
    PHP:
    this also work
     
    ogah, Dec 8, 2012 IP
  13. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #13
    Not if the file it's in is located in inc/
     
    Rukbat, Dec 8, 2012 IP
  14. ogah

    ogah Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #14
    of course lol
     
    ogah, Dec 8, 2012 IP
  15. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #15
    And we have no idea where the file is located (or if it even exists), so any path any of us posts may or may not work.
     
    Rukbat, Dec 8, 2012 IP