Include header issue
Results 1 to 3 of 3

Thread: Include header issue

  1. #1
    Junior Member
    Join Date
    Jan 2013

    Include header issue

    I am converting a site from html to php and having some issues with the includes 'header.php'. Warning: include(/header.php) [function.include]: failed to open stream: No such file or directory in /home/********/public_html/index.php on line 1

    Warning: include() [function.include]: Failed opening '/header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/*****/public_html/index.php on line 1
    these are the two warnings I get. I have both the index.php and header.php stored in the public_html folder. Just not sure...why I am getting these errors? Do I need to put the full path of /home/*****/public_html/ after the include tag?

  2. #2
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    "/header.php" in that context indicates a file named "header.php" that is in the root directory of the file system ("/").

    I'm guessing what you probably really want is something like:
    PHP Code:
    include $_SERVER['DOCUMENT_ROOT'].'/header.php'
    Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett

    "But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because hes a better programmer now!" ~

  3. #3
    Senior Member
    Join Date
    Apr 2003
    Flanders Fields
    Your error message tells you that one of your scripts cannot find a file it's trying to [man]include[man]. You should probably bone up on path references. Understanding them is a fundamental skill in programming. If you don't understand how path references work, you are likely to have a lot of problems in the long run.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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