pulkit Posted September 27, 2005 Posted September 27, 2005 Calling all webmasters and brains on buildtolearn :I want to embed a PHP page / code in a .html page (html extension)Pls tell me how to do itAlso i dont want to use the frame tag.Basically i want to replace the php extension of a webpage with htmlPls help I need it
mattofak Posted September 27, 2005 Posted September 27, 2005 Uh, do you have control over the server configuration...for instance on Apache, you simply add a new AddHandler call to the Apache httpd.conf file... theres a lot online to do it with... just take a look around, with IIS, same kind of thing, but its more complicated, same story though, just look around for changing the handlers of files...
RayOK Posted October 6, 2005 Posted October 6, 2005 (edited) this is somewhat simple.. actually, the first example here <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>php in html</title></head><body><?php print "hello! i work!";?></body></html> Edited October 6, 2005 by RayOK
mattofak Posted October 7, 2005 Posted October 7, 2005 unfortunatly, that wont work unless the server realizes it needs to process the page though the PHP preparser... you'll notice that that page still has a *.PHP extenstion, the question asked about PHP in a file with a *.HTML extension.
RayOK Posted October 7, 2005 Posted October 7, 2005 (edited) I tested it on our apache server.. worked fine with the .html extension I think its the <?php ?> that tells the server to parse it as php Edited October 7, 2005 by RayOK
mattofak Posted October 8, 2005 Posted October 8, 2005 Well, I dont know, I run Apache2 with PHP5, both using almost distro conf files, and it doesnt work for me...
RayOK Posted October 8, 2005 Posted October 8, 2005 (edited) Ahh.. I see now. I spoke with my good buddy, the server admin, and he said its a setting in the Apache config file. Its "AddType application/x-httpd-php .php .php4 .php3 .phtml .html" Just add the extension to the list Edited October 8, 2005 by RayOK
Rhelic Posted November 15, 2005 Posted November 15, 2005 Yes, you just need to edit your Apache config file and add the .HTML extension to be passed to your PHP module.But keep in mind this means EVERY .HTML on your site must pass through the PHP module, which slows your site down a little bit. If the site is very busy, this can become a problem but for the average website, it isn't.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now