Copy link to clipboard
Copied
Hi,
I have a very simple index.html file with a header div. I have put an include into it like this:
<div class="header">
<?php include("includes/header.php"); ?>
</div><!-- end .header -->
I have follwed David Powers setup_php to link to my localhost, putting the whole developement web in c:\websites\localhost\crown.
The actual header.php is in a subdirectory of crown called includes.
When I publish the site to a live server it works perfectly but not on locahost or in liveview.
I don't get any errors, just an empty header bar on the page.. I do get a warning across the top of the screen that I haven't installed flash(which I have)
I believe php is working OK on my localhost as running the php file direct in both liveview and F12 works OK.
BTW, I'm running CS5 on 64bit Win7 home premium. I've installed Apache 2.2.15 and php 5.2.14.
Any pointers greatly appreciated as I'm quite new to this.
Thanks,
Tim
Copy link to clipboard
Copied
Probably you should start to change your index.html into index.php otherwise your php code will not work.
Best regards
Copy link to clipboard
Copied
Yes, changing index.html to index.php works, but it then means I have to change all my html to php.
As the PHP Includes already work properly on the live server it must be something in my setup that's stopping it working on localhost and liveview. I can't have to have 2 versions of the website, 1 for live and 1 for test, that sort of defeats the idea doesn't it?
Copy link to clipboard
Copied
It surprises me dat php might work in a page that doesn't have the extension .php
I was under the strong impression that php code only works in a .php page.
Good luck.
Copy link to clipboard
Copied
You can run php on an HTML page, even if it has .htm extensions.
You can make this work by adding the following to your .htaccess file:
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm
This will then have PHP interpret your .html and .htm pages.
Copy link to clipboard
Copied
Thanks for that. It made me check.
My live server has it because the PHP Includes work there.
There is an identical htaccess file on my localhost.
So good helpful pointers but doesn't solve my problem of PHP includes not working on my localhost test site.
Tim
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more