Issues with PHP include_once – File Not Found Despite Correct Path

Discussion in 'PHP' started by devjoe, Sep 24, 2024.

Tags:
  1. devjoe

    devjoe New Member

    Joined:
    Sep 19, 2024
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Hi everyone, I’m trying to use include_once('config.php'); in my index.php, but I keep getting a "file not found" error. The file is in the same directory, and I’ve checked the permissions and paths, but nothing works. Any ideas what could be wrong? Thanks!
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    The file doesn't exist in the directory or you may have misspell the file name.

    Try printing the current path or use an absolute path using __DIR__ or dirname(__FILE__)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice