Problem with php script in .html page

Discussion in 'PHP' started by aleale, Aug 8, 2012.

  1. #1
    I have created pages on .html and used php codes into the page... Everything was going fine when i was using a different hosting. now i have changed my hosting and suddenly everything washed out..

    html codes are working fine on the page but the php code on same page is not working.

    What could be the issue??
     
    aleale, Aug 8, 2012 IP
  2. JamesColin

    JamesColin Prominent Member

    Messages:
    7,874
    Likes Received:
    164
    Best Answers:
    1
    Trophy Points:
    395
    Digital Goods:
    1
    #2
    JamesColin, Aug 8, 2012 IP
  3. akthechamp

    akthechamp Greenhorn

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    why not convert those html pages to php ? as JamesColin said..the web server is not treating them as dynamic pages..
     
    akthechamp, Aug 9, 2012 IP
  4. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #4
    Just change the .html to .php and they should run. (Someone at your old hosting company modified the server to work for people who don't understand how servers work. The standard is to use the proper file extension - .php in this case.)
     
    Rukbat, Aug 10, 2012 IP
  5. DomainerHelper

    DomainerHelper Well-Known Member

    Messages:
    445
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    100
    #5
    Always keep html separate from php as much as you can. Or just rename the file to .php and put this into your .htaccess:

    This one makes all .php to be called as .html.
    RewriteEngine On
    RewriteRule ^(.+)\.html$ $1.php [QSA,L]
    PHP:
    This one for just one script:
    RewriteEngine On
    RewriteRule ^scriptname\.html$ /scriptname.php [QSA,L]
    PHP:
     
    DomainerHelper, Aug 10, 2012 IP
  6. ibnatu

    ibnatu Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i like to keep php in php files, but just adjust your config files to let your server know theres php in there.
     
    ibnatu, Aug 14, 2012 IP