1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to put PHP code in an HTML file??

Discussion in 'PHP' started by Istvan, May 8, 2008.

  1. #1
    Hi DPers, I have to put some lines of php code in an html webpage. I can't change it's extension because it is already indexed by SE with html.

    I have done a couple of searches and some sites suggest to add this line in .htaccess file
    [FONT=Arial][SIZE=2][COLOR=black][COLOR=black][FONT=Arial]AddHandler application/x-httpd-php .html .htm[/FONT][/COLOR][/COLOR][/SIZE][/FONT]
    Code (markup):
    But this doesn't work for me, because when I access the site I see the download window instead instead of showing the webpage.

    Any idea?

    Thanks
     
    Istvan, May 8, 2008 IP
  2. e96

    e96 Active Member

    Messages:
    299
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    80
    #2
    are you using godaddy by chance?
     
    e96, May 8, 2008 IP
  3. ksamir2004

    ksamir2004 Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ksamir2004, May 8, 2008 IP
  4. Istvan

    Istvan Well-Known Member

    Messages:
    1,543
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    175
    #4
    no, I'm not using Godaddy hosting.

    I have tried both, with the first I get the same problem (download windows) and the second doesn't show php output. :(

    Otherwise, is there something I can modify in html file headers? Can the following be the problem?
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    Code (markup):
    Thanks
     
    Istvan, May 8, 2008 IP
  5. Istvan

    Istvan Well-Known Member

    Messages:
    1,543
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    175
    #5
    nobody can help me ??
     
    Istvan, May 10, 2008 IP
  6. Bagi Zoltán

    Bagi Zoltán Well-Known Member

    Messages:
    364
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #6
    Try with this one
    AddType application/x-httpd-php .php .html
    Code (markup):
     
    Bagi Zoltán, May 10, 2008 IP
  7. clinton

    clinton Well-Known Member

    Messages:
    2,166
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    110
    #7
    [FONT=Arial][SIZE=2][COLOR=black][COLOR=black][FONT=Arial]AddHandler application/x-httpd-php .php .htm .html .htm
    AddHandler application/x-httpd-php5 .php .htm .html .htm[/FONT][/COLOR][/COLOR][/SIZE][/FONT]
    Code (markup):
    if your running php 5 I think you have to do that(what I just added to the quote.)

    if your running php 4, change the 5 in the code to 4, I think.

    I got it from this article:
    http://websitedesign.websitesinaflash.com/2007/04/htaccess-addhandler.html
     
    clinton, May 10, 2008 IP
    Istvan likes this.
  8. Istvan

    Istvan Well-Known Member

    Messages:
    1,543
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    175
    #8
    It works fine! Thank you! :)

    +rep
     
    Istvan, May 12, 2008 IP
  9. clinton

    clinton Well-Known Member

    Messages:
    2,166
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    110
    #9
    Sweet, thanks for the rep:)
     
    clinton, May 12, 2008 IP