Right; and get rid of the dots in your code. If you begin the path with a forward slash then it's a root-relative path. I think it may be better to use something like the following. But how do you fix it? This manifests itself in interesting ways that can be seemingly unrelated. PHP It will cause __FILE__ to return a relative path instead of the full path which it is supposed to show. You need to integrate with other Windows services like Active Directory, Windows file shares, or Microsoft Exchange. It could be a little glitch. While using this site, you agree to have read and accepted our. Any help you can provide is greatly appreciated. ... If you’re going to use DOCUMENT_ROOT, you need to add a slash after it: But your other attempt should have worked if the file is in your yourdomain.com directory: An example of how I use includes in my file is: Try that - or some variation of it. First off thanks for reading this. No, there's no mention of header.php in the log file. I have learnt to manipulate this code into an effecitve and easy to use form. If your file is in your domain.com folder, then putting a / before the file name would probably fix your document_root example. When using symbolic links with PHP, specify a dotslash './page.php' path to ensure that PHP is looking in the right directory with nested requires: E.g.

It's not necessary to write: When using symbolic links with PHP, specify a dotslash './page.php' path to ensure that PHP is looking in the right directory with nested requires: If you are experiencing a bug related to using relative paths with include or require, it may be related to a grandparent directory that is executable but not readable. Document_root won’t work if it’s in your user directory–only the domain.com directory, since that is the document root. By default, files with a .html extension aren’t checked for anything that needs to be processed by another scripting engine, IE: PHP. The $_SERVER[‘DOCUMENT_ROOT’] . Now everything is working when I view admin/index.php (PHP includes the header.php to index.php) except the CSS. Please sign in or sign up to post. server executes it), with the include or require statement.

Task 2 asks you to use a relative path so you should not begin your path with a forward slash because that's a root The include (or require) statement takes all the text/code/markup that exists in the specified file and copies it into Re: PHP include not working -- Cannot include header.php file insite index.php Originally Posted by abhimanyu0003 No, there's no mention of header.php in the log file.