TwiztedCupid Posted December 23, 2006 Share Posted December 23, 2006 Hello,Yes I'm pretty much a n00b when it comes to PHP and Apache. I have the server all setup, php installed, PHP modules all setup in httpd.conf. I can run .php files with no problem. The one thing I'm not getting to work is [code]<?php phpinfo();?>[/code] It works when I save the file as test.php, but not when I save it as test.html, or test.htm. It just shows up as a blank page. I viewed the source and the code is still there. When I upload either htm file to another server, the phpinfo function works fine. I need to know if there's something in Apache or PHP that I have to configure to let this run properly on my machine.I'm using Apache 2.2.3 and PHP 5.2. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 23, 2006 Share Posted December 23, 2006 If you want htm(l) files to parse PHP code then you will need to the server that. You can do that by adding .htm and/or .html to the end of the list for the following line in the httpd.conf:[code]AddType application/x-httpd-php .php[/code]Like so:[code]AddType application/x-httpd-php .php .htm .html[/code]Save the httpd.conf and restart Apache. PHP code will now be executable in .htm and .html files Quote Link to comment Share on other sites More sharing options...
Stray_Bullet Posted January 3, 2007 Share Posted January 3, 2007 Or if you use .htaccess files you can just use the ForceType directive...Create a .htaccess file in the same directory as the file you want to call "test.html"... Add this to the .htaccess file...<FilesMatch "test.html"> ForceType application/x-httpd-php</FilesMatch>Hope this helps! ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.