[nycphp-talk] php include file question

Ian Forsyth ian at
Mon Mar 31 15:38:48 EST 2003

Hi Deidra,

On Monday, March 31, 2003, at 09:52 AM, Deidra McIntyre wrote:
> I'm breaking up my html site into includes (header, copyright, etc.).
> Within the HTML documents that call the include files, I have the
> appropriate php tags (i.e. <? include("copyright.html"); ?> . All of 
> the
> includes (i.e. copyright.html) are sitting in the same directory as my
> html pages (i.e. index.html). PHP is installed.

Does the file that contains the php include end with .php or .html. 
what happens if you make a page with the same suffix as the files that 
contain the includes containing <?php echo "hello world";?>  <? echo " 
hello world "; ?> do both of them show up?

> So, why, no matter what I do, don't the include files parse into my
> document? I have tried to changed the include extensions from .html to
> php to .inc. None parse. Most of my includes contain basic HTML (no 
> php)
> like <p>Copyright &copy; 2003. All Rights Reserved.</p>.

Most hosting providers require that a file end with .php in order for 
the php functions to work. Also some configurations do not allow for 
the 'short tag' format.. Meaning to use php you have to start your code 
with <?php not just <? .

> Am I doing something wrong? Or does my technician need to change 
> something
> in the server configuration (if so what)?

If you have a large amount of files that you are updating with includes 
and the files all end with .html or .htm..  check to see if you hosting 
company allows for .htaccess files. If so you can tell php to parse 
.html files so your file list.html can contain includes and php will do 
what it is supposed to. this is what would be in the .htaccess file of 
your websites top directory

AddType application/x-httpd-php .php .html .htm

Otherwise you might have to rename all your .html files to .php


More information about the talk mailing list