Results 1 to 4 of 4

Thread: How do we make html file with PHP?[ Question ]

  1. #1
    Join Date
    Jul 2013
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Lightbulb How do we make html file with PHP?[ Question ]

    Yes, how do we make html file with PHP? You may noticed that every mybb form has a thread with extension .html but according to me, to run php you should have .php extension and Mybb is also in php. How do they do it. Any suggestions? In simple words, how to run php coding in an HTML webpage?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    There are two ways:
    1. Tell your webserver to run .html files through the .php parser. It won't hurt anything (because a normal .html page will just be output without doing anything to it, but now also any PHP will be executed), but it will slow your server a bit-- now every .html page is treated as a (slightly slower-- parsed) PHP page.

    2. Use some kind of URL remapping so that when you get a request for .html you actually serve a .php file (behind the scenes; the user won't ever know).

    Both are a little complicated but can be done using something like .htaccess, depending on your server's configuration. If you don't have full access to the server, it's possible you can't alter these settings.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:


  4. #3
    Join Date
    Jul 2013
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I love complicated things thanks.

  5. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,938
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    11

    Default

    That was one thing that used to puzzle me when I got my first web hosting account because I'd read forum posts where people said that php scripts only worked on a php enabled host, in pages ending with the .php extension - except my scripts always worked fine in my .html pages without any intervention on my part. Anyway, when I started looking into .htaccess, I realised that my web host already provided this line in my .htaccess file;
    Code:
    AddType application/x-httpd-php .html .htm
    That's when I realised what this line did - it was parsing PHP on .html/.htm pages. It was pretty convenient at the time, but as Dan already said, it makes the server work harder so those old pages are a little slower than newer ones ending .php
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

Similar Threads

  1. Replies: 2
    Last Post: 11-24-2009, 07:53 PM
  2. Replies: 1
    Last Post: 06-08-2009, 02:05 PM
  3. Replies: 2
    Last Post: 07-13-2008, 06:39 PM
  4. Replies: 6
    Last Post: 11-02-2006, 09:53 AM
  5. HTML File or HTML Document?
    By djm in forum HTML
    Replies: 10
    Last Post: 08-02-2005, 02:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •