I run a IIS 6.0 Server 2003 Test.php <?php // testing sessions // check to see if files are being created // in the session.save_path folder session_start(); ?> <html> <head> <title>PHP Test</title> </head> <body> <p> The browser you're using is <?php echo $_SERVER['HTTP_USER_AGENT']; ?> </p> <p> <!-- test the browscap setup --> Your browser's capabilities are: <br/> <pre> <?php print_r(get_browser(null, true)); ?> </pre> </p> <?php phpinfo(); ?> </body> </html> This file runs fine from a browser as long as its named .php It will not run as an .htm file How do I set my server to make .htm run this script or if its not the server am I missing some sytax. I assume php can be run as htm. Fricking drivin me nuts for days
Traditionally, no. To run PHP you have to have your file named with .php. However, I believe there is some configuration for your server that will allow you to "embed" php into other pages - you would have to contact your host about this, and I doubt that they will change it. Why must your pages be .htm? If you needed to keep the .htm for linking/seo purposes, you could always use your .htaccess file to take the URL mysite.com/page.htm and actually call mysite.com/page.php
Unfortunately, .htaccess files do not work with IIS. I don't know if there is any easy way to make this work on a Windows Server. Here is a thread about it. http://www.vbulletin.com/forum/showthread.php?t=179450
Good point. I remember reading him say IIS but it must not have registered upstairs. Also a good point.