php include isssue with php 5.2.6

I have done php includes in html pages literally 100's of time on my server with 4.3.9 PHP. I am developing a site  on another server which uses PHP 5.2.6 and when I the same thing it does not work.

I have tried <? include("a_test.php"); ?> and ?php require_once("a_test.php"); ?> neither will work

The include is live at http://kayakfl.com/a_test.php

This is my test page where the include should render http://kayakfl.com/aws.html

I can't change page names to php.

I have both files at root level

I have an added an .htaccess file handler
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

Any thoughts?
abacus41Asked:
Who is Participating?
 
Marco GasiConnect With a Mentor FreelancerCommented:
You can't use include function in html page. aws page must be a php page: rename it as aws.php and it will work.

Cheers
0
 
abacus41Author Commented:
Thanks for the feedback but that is not the case. For example http://www.mandalamedspa.com/index.html - this is how it is coded in Dreamweaver

</head>

<body onload="P7_initPM(0,7,1,0,-1)">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="mainbody">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="858" align="left" valign="top">
                  <?
                              include("includes/header.php");
                  ?>            </td>
      </tr>
      <tr>
        <td align="left" valign="top" class="bodybg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="83" align="left" valign="top">
                  
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                              <td>      
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" valign="top">
            <?
                              include("includes/left.php");
            ?>      </td>
  </tr>
0
 
Marco GasiFreelancerCommented:
aws.html is made with Dreamweaver?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
PorterGraphicsCommented:
Have you confirmed that php does work on this server?
0
 
Marco GasiFreelancerCommented:
If http://www.mandalamedspa.com/index.html  works, then php works, but I don't understand how it is possible use php code within a html page: Dreamweaver can have something to do with this.
0
 
PorterGraphicsConnect With a Mentor Commented:
I have used php on an html page before and used Dreamweaver. That's why I thought maybe php wasn't installed on the new server.
0
 
PrograministratorConnect With a Mentor Commented:
Hello,

edit the main .htaccess file of your site (or create one if not exists),

and just add this line :

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

Open in new window


This line allow parsing php code in .html or htm files.

Good luck.
0
 
abacus41Author Commented:
Thanks for all the comments:

Yes php works on server, see
http://kayakfl.com/Lido_Accommodations.php

htaccess file in place but I updated to the handler code above

Dreamweaver does not change the code of the incluide.

Yes, aws.html is made in Dreamweaver>
0
 
PorterGraphicsCommented:
When I look at the source of aws.html after the page is loaded, I can see the php code, which makes me believe the problem lies with the server. Have you tried a simple echo command on the aws.html page to see if that code gets processed?
0
 
abacus41Author Commented:
No, how do I do that?
0
 
PrograministratorCommented:
@PorterGraphics : that's could be true, but in addition, if the php code can't be parsed correctly in .html files, then php code will be viewable,

@abacus41 :

in .htaccess romove this lines :
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
addhandler application/x-httpd-php .htm .html 

Open in new window


and try to specify that your working with php5 like this :

AddHandler application/x-httpd-php5 .php .htm .html

Open in new window


if it isn't working, try this :

AddHandler x-mapp-php5 .php .htm .html

Open in new window


Usually, that's based on hosting company's servers
0
 
Ray PaseurConnect With a Mentor Commented:
This from the "aws" page.  It confirms what others have said here: The file was not parsed through PHP.  You may not be able to make changes to .htaccess, but your hosting company can do that for you.  I often let .html files be parsed through PHP.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p>test page and down below we have the include content</p>
<p>
 

 
 
  
   <?php require_once("a_test.php"); ?>
   
  
</p>
</body>

</html>

Open in new window

0
 
abacus41Author Commented:
I have gone back to the web hosting company to sort. I will leave the ticket open until I have it sorted and then split up the points as you have all tried hard to help me.

Regards,

David
0
 
Ray PaseurCommented:
Good luck with it.  If you find that your hosting company does not immediately understand and fix the issue, you may be in the market for a new hosting company.  I use and am glad to recommend Chihost.com.  Some of my colleagues like Dreamhost, HostGator and SliceHost.
0
 
abacus41Author Commented:
The issue was at the hosting company and the feedback helped me narrow things down.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.