How do I get my php code to run on html pages without a .php extension? I tried this but it doesn't work:
CODE for index.html
<html><head></head><body>
<?php include("test.php"); ?>
</body></html>
------------------------------------------------------------
test.php in same folder consists of the following text and nothing else: THIS IS DISPLAYING BECAUSE PHP IS WORKING!
------------------------------------------------------------
CODE for .htaccess in same folder:
AddType application/x-httpd-php .html .htm
------------------------------------------------------------
Firefox gives me: Download Error
C:\......Local\Temp\index-11.html could not be opened, beacuase the associated helper application does not exist. Change the association in your preferences.
Internet Explorer just gives me a blank page.
Thanks,
Al
Php Code on html pages
Moderator: General Moderators
Re: Php Code on html pages
Just to check the obvious first:
You're running these scripts in Apache, WAMP, or XAMPP? And the URL in the browser starts with "http://"? And the domain name is probably localhost?
You're running these scripts in Apache, WAMP, or XAMPP? And the URL in the browser starts with "http://"? And the domain name is probably localhost?
Re: Php Code on html pages
cPanel Version 11.30.6 (build 4)
Theme x3
Apache version 2.2.22
PHP version 5.2.17
MySQL version 5.1.56
Architecture i686
Operating system linux
Dedicated IP Address 74.53.140.71
Path to sendmail /usr/sbin/sendmail
Path to Perl /usr/bin/perl
Perl version 5.8.8
Kernel version 2.6.38.7
cPanel Pro 1.0 (RC1)
http://www.ams007.com/newimage/index.html
Theme x3
Apache version 2.2.22
PHP version 5.2.17
MySQL version 5.1.56
Architecture i686
Operating system linux
Dedicated IP Address 74.53.140.71
Path to sendmail /usr/sbin/sendmail
Path to Perl /usr/bin/perl
Perl version 5.8.8
Kernel version 2.6.38.7
cPanel Pro 1.0 (RC1)
http://www.ams007.com/newimage/index.html
-
JoeCommodore
- Forum Newbie
- Posts: 15
- Joined: Fri Oct 01, 2010 10:16 pm
Re: Php Code on html pages
You need to set your apache (or other web server) handler to have PHP process the pages with .htm and .html... Something that could be answered with a google search or in the php installation and configuration forum. Though if you plan to distribute your scripts, I would advise not to do that.
Re: Php Code on html pages
in cpanel, is it in the section titled "Apache Handlers"?
Re: Php Code on html pages
If all else fails or you are in a hurry, you could always use an iframe!