Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It may be because <code>master.php</code> is being included or required by <strong>another script file that is not in the same directory</strong> as <code>header.php</code>. That is, when you visit the index, do you know which file is being invoked/parsed?</p> <p>Take a look at the <a href="http://us3.php.net/manual/en/function.include.php" rel="nofollow noreferrer">documentation</a> for <code>include()</code>, which also applies to <code>require()</code>:</p> <blockquote> <p>Files for including are first looked for in each include_path entry relative to the current working directory, and then in the directory of current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/</p> </blockquote> <p><strong>Update</strong></p> <p>To address some of the comments: I didn't say that include() would change the CWD. I'm saying that if the CWD is not the one where both master/header.php are located, that could be the issue.</p> <p>For example, say you have <code>index.php</code> in a different folder than <code>master.php</code> and <code>header.php</code>; it includes or requires <code>master.php</code> using the proper path to it. Now, <code>master.php</code> has the statement:</p> <pre><code>&lt;?php require_once("header.php"); ?&gt; </code></pre> <p>However, at this point the CWD <em>does not contain</em> <code>header.php</code>, since the CWD is that of <code>index.php</code>.</p> <p>To fix this, you need to call <code>require_once</code> with the proper path from the CWD of the current script to <code>header.php</code>, NOT the path from <code>master.php</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload