#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    18
    Rep Power
    0
    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...?
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    That would do it. Of course, it would cause ALL html extended files to parse whether there was PHP in them or not.
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    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...

    ---John Holmes...
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    27
    Rep Power
    0
    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)

    succes


    ------------------
    don't blame me, im blond
    :-)
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    18
    Rep Power
    0
    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)
  10. #6
  11. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    wouterr,

    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.

    my $0.02...

    ---John Holmes...
  12. #7
  13. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    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..

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

Similar Threads

  1. MS Access & mdb files with PHP in LINUX
    By quiquedcode in forum PHP Development
    Replies: 9
    Last Post: February 11th, 2004, 11:06 AM
  2. Converting DOC files to PDF files using PHP
    By necrophagous in forum PHP Development
    Replies: 3
    Last Post: February 6th, 2004, 12:36 PM
  3. Can php be used in html files
    By emzyme in forum PHP Development
    Replies: 3
    Last Post: January 29th, 2004, 01:50 PM
  4. all-in-one php script displaying html
    By emzyme in forum PHP Development
    Replies: 5
    Last Post: January 27th, 2004, 07:07 AM
  5. php n00b. Put a php file into an html template?
    By WorldBuilder in forum PHP Development
    Replies: 3
    Last Post: January 25th, 2004, 08:48 PM

IMN logo majestic logo threadwatch logo seochat tools logo