ck777
ck777

Reputation: 133

wampserver not showing footer and header or CSS

I am using wampserve to view my site on a local server.

I can see the text but none of the CSS/Less is being applied and my header and footer are not visible. I get the message

Warning: include(C:/wamp64/www//Includes/Header.php): failed to open stream: No such file or directory in C:\wamp64\www\flying-squid\html\index.php on line 5

and

Warning: include(): Failed opening 'C:/wamp64/www//Includes/Header.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp64\www\flying-squid\html\index.php on line 5

for both my header and footer.

I have looked at so many other questions on this topic here and have tried all steps to no avail.

Here is my php code in my index.php file

<?php 
$pagetitle      =   "About";
$description    =   "";
$keywords       =   "";
include($_SERVER['DOCUMENT_ROOT']."/Includes/Header.php");

?>

I have tried header/includes being in lowercase and as it is above but nothing works.

I am very new to this and don't really know much php yet, I have been learning css, html, less and javascript.

Any help much appreciated.

Thanks

Upvotes: 0

Views: 901

Answers (1)

Cale W. Vernon
Cale W. Vernon

Reputation: 139

A good practice to help prevent this problem is to maintain naming conventions, such as directories and files standardly being entirely lowercase. That way you will not get hung up on wondering if character case is part of your issue.

Depending on the structure of your site you may want to try multiple approaches:

  • __DIR__./../..
  • ($_SERVER['DOCUMENT_ROOT']."Includes/Header.php")
  • include('../Includes/Header.php')

As you're admittedly new to PHP, I wanted to let you know that this is common when using include(), include_once(), require() and require_once() inclusions (among other file manipulation functions). Any and all of these functions throw this Warning if it cannot locate the file specified exactly at the path it was given.

Upvotes: 1

Related Questions