Include header issue
Results 1 to 3 of 3

Thread: Include header issue

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    26

    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
    Location
    Ankh-Morpork
    Posts
    13,885
    "/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!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html


    eBookworm.us

  3. #3
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,830
    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
  •