>>>> How the hell do I display PHP in .shtml files? <<<<<

Discussion in 'PHP' started by medaa25, Jan 20, 2008.

  1. #1
    I am trying to display a simple php code on my website. All my files use .stml as extensions and these don't seem to display even a simple php code like:

    <html>
    <body><?php
    echo "Hello World";
    ?></body>
    </html>


    I am on a windows plan therefore can't use .htaccess to fix this (my host says).

    I have had a look at Mime but it seems like it is not the way to go as there is not Mime type for php, apparently. MIME TYPES

    Sorry for my naivity I am trying to learn PHP... :p

    The last resort would be to change all my files extensions to .php but it will hurt my ranking for a while and I can't afford this.

    Is there a savior over here??

    Rep to anyone who help me sort this out :)
     
    medaa25, Jan 20, 2008 IP
  2. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #2
    Ask your host to allow Apache to send .shtml requests to php parser.

    open httpd.conf. search for "AddType application/x-httpd-php" (without quotes) and add .shtml after .php

    AddType application/x-httpd-php .php .shtml
     
    greatlogix, Jan 20, 2008 IP
  3. medaa25

    medaa25 Active Member

    Messages:
    388
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Does this have anything to do with MIME?

    I can't find httpd.conf. . I will have to argue with my host again and they will get back to me saying that I am on a shared server and can't process my request... </
     
    medaa25, Jan 20, 2008 IP
  4. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #4
    No.
    You can find httpd.conf file in 'conf' directory under your apache installation.
    It's Better to change your hosting.....
     
    greatlogix, Jan 21, 2008 IP
  5. medaa25

    medaa25 Active Member

    Messages:
    388
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    60
    #5


    Thanks for your help mate but I can't find any of this. I am on a shared windows server so that may be the reason why...

    I have had a chat with support and they told me .shtml and .php where not recommended on windows and that I should move to a unix server. He also told me it was not possible to for .sthml files to parse php.

    I don't know what to make of this.

    I am going to use SSI like so,

    <!--#include virtual="/myfile.php" -->

    the php files will be processed server sides and return html which should be displayed regardless of my .sthml file extension ;)

    Hope for the best!
     
    medaa25, Jan 21, 2008 IP