July 13th, 2000, 12:28 PM
Is it possible to have an page with an html extension that can contain and run PHP scripts?
If html was added to the PHP file types in the apache httpd.conf...?
July 13th, 2000, 03:52 PM
That would do it. Of course, it would cause ALL html extended files to parse whether there was PHP in them or not.
July 13th, 2000, 10:08 PM
A good recommendation i saw on here was to have .html extension as regular html, and have .htm extension parsed with php. this makes it look like your site is all html (needed if you want search engines to look at your pages) and gives you a way out of the little bit of overhead of parsing every file with php...
July 14th, 2000, 02:15 AM
if you just place <?php and ?> tags in you html files, this part of the html file will be parsed as a php script
so you dan't actually need the extension..
(this is what my php-book says, i don't have experience with it)
don't blame me, im blond
July 14th, 2000, 03:13 AM
OK figured it out- i've added .html to the PHP file types- now .html files get parsed but not the .htm
Presumeably it means that my dynamic pages with the .html extension will now get indexed by search engines?
BTW: would that mean the database content would also get indexed (since when the .html page is viewed it will contain the database stuff)
July 14th, 2000, 07:31 AM
that's not really true. the web server doesn't know whether a file has php code in it or not, the only way it can tell is by the extension of the file the browser is requesting. you can set up any extension to be parsed as php, normally it's .php or .phtml, but you can use .foo .inc or whatever, as long as you set it up in your web server. you can make it so every file is parsed by php also, whether there is php code in it or not. this creates some extra overhead by sending everything through php, but i've heard it's not that bad.
July 15th, 2000, 10:42 AM
Yes, like sepodati says.. and I have to agree.
Setting the server to PHP parse htm/html could really put a hefty workload on it.
After all the server will parse "every single" htm/html page in your domain for PHP code.. it doesn't know if the codes there or not, but it does what you tell it.. so it has to pass all your documents to PHP.. if there's PHP in it, then PHP does the work, otherwise it's really just a wasted process.
Frankly, the idea of giving just one of the two extensions to PHP would cut down the workload for the server..
The only plus I see to this passing htm/html to PHP is if you don't want people to know you are using PHP.. and why you'd wanna do that is kinda beyond me??
Another thing to consider in this scenario, is if you already have the server set up to pass htm/html through the SSI process.. if so you're apt to cause a major conflict with the server.. or very seriously slow things down.
And I know that a lot of host servers are configured in such a way, to parse htm/html as ssi. since a lot of users like to further conceal their use of SSI..
Low Cost Hosting and Web Development.