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.

php include in HTML file won't display, .htaccess edit didn't help - Godaddy hosted

Discussion in 'Apache' started by fensterbaby, Dec 31, 2008.

  1. #1
    I put the following in the .htaccess file at root:

    AddHandler x-httpd-php .php .htm .html

    But nothing displays. My include reads...

    <? include("sig.php") ?>

    The php file contains just simple html

    Saw somewhere that I may need to edit the config file... but don't know what that is.

    I am on a Godaddy hosting account

    Thanks!

    gf
     
    fensterbaby, Dec 31, 2008 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    It might just be your syntax. Try this AddHandler application/x-httpd-php .html

    and if you want htm also add another line AddHandler application/x-httpd-php .htm

    Post back and let us know if it worked or not.

    Most php stuff is done in the php.ini file at GD but the handler is an Apache thing.
     
    Colbyt, Dec 31, 2008 IP
  3. fensterbaby

    fensterbaby Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Tried adding that but no effect
     
    fensterbaby, Dec 31, 2008 IP
  4. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #4
    How are you editing the .htaccess file? Notepad has a nasty habit of saving it as a text file and not as a file with no extension labeled .htaccess

    If you are sure you have saved it in the proper format then check the root directory where the files are located (the same as your public directory) if you only have one site hosted there, and look for a file name php.ini.

    Try adding that same line to the top of that file. If you don't have a php.ini file create a new one.

    One other thing I just recalled that the absolute lowest level of GD hosting does not even support php. Are you sure you have php for your account?
     
    Colbyt, Jan 1, 2009 IP
  5. fensterbaby

    fensterbaby Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    .htaccess has no extension.

    I created a php.ini file in the root level and put this:

    AddHandler application/x-httpd-php .html​

    in php.ini and also the .htaccess

    Still no joy.

    I know php is working on the server as I am in testing mode on a Wordpress installation which is working fine.

    A php file with a php include works. But an HTML file won't display php includes or SSI.
     
    fensterbaby, Jan 1, 2009 IP
  6. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #6
    It works on my local machine and every server that I have ever used it on. Godaddy may have the option disabled. They are well known for that type of thing. I suggest you send their support a message and see what they have to say.

    Other than moving to a real host that is about your only choice at this time.

    Sorry I could not help.
     
    Colbyt, Jan 1, 2009 IP
  7. fensterbaby

    fensterbaby Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Called support at GD and no help. They say it should work though, the capability is not disabled. I have seen lots of other folks with this same problem and they do get it to work so I know there is a resolution and it's got to be a matter of the write .htaccess entries.

    Whooa

    Just tried something else in the middle of writing this post. Okay it works.

    Here's what I did - added the following to my .htaccess

    Action application/x-php /cgi-bin/php
    AddHandler application/x-php .html .htm

    Like I said, it would be helpful to know why and what's going on. Is GD putting php in a place in the directory structure that is not usual?

    Also wanted to know if there is any reason why the above .htaccess entries are not a good idea. I'm over my head here but I know that just because something works doesn't mean it's a good idea.

    Thanks

    ps- What I really don't get is why the guys at GD are so clueless about this as I am clearly far from the first to have this issue with them.
     
    fensterbaby, Jan 1, 2009 IP
  8. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #8
    Okay! They must have php configured to run as CGI. Great find.

    No reasons why you should worry about it. I have more than one site where php is parsed as html and have never experied a problem.

    Like most large hosts you have to get to the level 3 support before they really know what they are doing. Level 1 only has scripts to read from. Level 2 has a database but really doesn't know how to use it. Level 3 can use the database and Level 4 knows what they are doing and doesn't need the database in most cases.

    Pat yourself on the back. You deserve it.
     
    Colbyt, Jan 2, 2009 IP