Questions with .php, .html, and the include statement

I have been doing a site and I am having a problem getting my include statement to work. I have also changed all of my files to .html and .php and neither one works. Also my code DOES work when I do it in my editor but when I put it on my server it DOES NOT work. It only does my index page and that is it. Not sure what is going on.Here is the code:

This is my index.php file.

<!DOCTYPE html>
<html lang=“en”>
<head>
<meta charset=“utf-8”>
<title>Braswell Electric</title>
<link rel=“stylesheet” href=“braswellelectric.css”>
</head>
<body>
<div>
<?php include(‘header.html’);?> /* this is where my include statement should be getting my header file */
<?php include(‘aside.html’);?>

<article class=“About”>
<header class=“AboutHeader”>
<h2>About Us</h2>
</header>
<p><b>paragraph goes here.</p>

&lt;img src="pics/Coach Light.jpg" alt="Coach Light" &gt;
&lt;img src="pics/Outside Plug.jpg" alt="Outside Plug"&gt;
&lt;img src="pics/Service.jpg" alt="Service"&gt;

</article>
</div>
</body>
</html>

Here is my header.html file

<!DOCTYPE html>
<html lang=“en”>
<head>
<meta charset=“utf-8” />
<title></title>
</head>
<body>
<header class=“Header”>
<h1 style=“display: none”>Braswell Electric</h1>
<img src=“pics/lightning1.jpg” alt=“Header Pic”>
</header>
</body>
</html>

A couple of things to note:

  1. Don’t include code like doctypes etc. in an include file. Just put the HTML bits that need to be included in the page. Otherwise you end up with multiple doctype declarations, head and body tags, which is a real disaster.

So, for example, the header file should just contain this:

<header class="Header">
<h1 style="display: none">Braswell Electric</h1>
<img src="pics/lightning1.jpg" alt="Header Pic">
</header> 
  1. Be careful where you store the include files. With the code you posted, they must be in the same folder as the index.php file, which isn’t all that convenient.

I’ve got a simple tutorial on PHP includes here in case you’re interested.

Which server are you running, and is it configured correctly? Does other PHP code work, that is, are you just having a problem with includes, or all php? Is the server case-sensitive, and if so, does the filename case match the include statement?

I am using Charter webspace as my server. I am not sure if it is configured because I haven’t learned how to do that yet. My index.php page shows up on the server but it isn’t reading the include statement. I am pretty sure it is case sensitive so I have everything in lowercase.

You need to figure out whether it’s running the php code or not - if it is, then there’s a problem with the include files (location, for example), if not, then I’d imagine a problem configuring the server. If you add a simple


<?php echo "Hello"; ?>

towards the start of the file, does it execute and display ‘hello’, or not? If not, server isn’t configured to process php files.

A quick search on the Charter webspace help file does say this though:

"•Some programs used to create web pages and server processing will not work with our web server. Those known programs are Microsoft FrontPage Extensions, PHP, ASP, Pearl Scripting, and CGI. "

After some digging I finally found out that Charter FTP doesn’t handle PHP. That is why it wasn’t working. Sorry for the bother but I still learned something from all of you . Thanks again.