The time now is 12/02/08 - 05:10
Log in: Username: Password:
Search forums for:
  

php in a .html file

Post new topic   Reply to topic
Author Message
cheese
Luke Warm
Luke Warm


Joined: 08 Dec 2004
Posts: 241



PostPosted: 01/24/05 - 15:39    Post subject: php in a .html file Reply with quote

I've got a html file with a little bit of php in it. When I add .html to the php mime type in apache it will no longer process html files at all. and only one server is doing this. any idea why this would happen..

basically when you try to hit any .html page it acts like it doesn't know the mime type. and prompts a save box.
Back to top
kireol
RealPoor Master of Posts
RealPoor Master of Posts


Joined: 02 Aug 2003
Posts: 9517
Location: Royal Oak, MI



PostPosted: 01/24/05 - 16:11    Post subject: Reply with quote

sounds like you havent installed PHP correctly. redo that. or just look in your httd.conf and look under the php mime type and double check it. it's simple to install php.
Back to top
cheese
Luke Warm
Luke Warm


Joined: 08 Dec 2004
Posts: 241



PostPosted: 01/24/05 - 16:14    Post subject: Reply with quote

well php is installed cause I can run php as long as the extension is .php its only when I add .html... but maybe somone patched or made a change and screwed something up may have to just reinstall php...
Back to top
kireol
RealPoor Master of Posts
RealPoor Master of Posts


Joined: 02 Aug 2003
Posts: 9517
Location: Royal Oak, MI



PostPosted: 01/24/05 - 16:25    Post subject: Reply with quote

my php.conf file under fedora linux

Code:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php4_module modules/libphp4.so

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddType application/x-httpd-php .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
Back to top
kireol
RealPoor Master of Posts
RealPoor Master of Posts


Joined: 02 Aug 2003
Posts: 9517
Location: Royal Oak, MI



PostPosted: 01/24/05 - 16:27    Post subject: Reply with quote

html in apache

Code:
<Directory "/var/www/manual">
    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all

    <Files *.html>
        SetHandler type-map
    </Files>

    SetEnvIf Request_URI ^/manual/de/ prefer-language=de
    SetEnvIf Request_URI ^/manual/en/ prefer-language=en
    SetEnvIf Request_URI ^/manual/fr/ prefer-language=fr
    SetEnvIf Request_URI ^/manual/ja/ prefer-language=ja
    SetEnvIf Request_URI ^/manual/ko/ prefer-language=ko
    SetEnvIf Request_URI ^/manual/ru/ prefer-language=ru
    RedirectMatch 301 ^/manual(?:/(de|en|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2
</Directory>
Back to top
kireol
RealPoor Master of Posts
RealPoor Master of Posts


Joined: 02 Aug 2003
Posts: 9517
Location: Royal Oak, MI



PostPosted: 01/24/05 - 16:29    Post subject: Reply with quote

oops forget that last html post. but check your php.conf vs mine.

I'm not sure where apache says ".html" is an HTML file
Back to top
kireol
RealPoor Master of Posts
RealPoor Master of Posts


Joined: 02 Aug 2003
Posts: 9517
Location: Royal Oak, MI



PostPosted: 01/24/05 - 16:30    Post subject: Reply with quote

/etc/mime/types


text/html html htm




if that's not it, i'd reinstall or google it.
Back to top
Occulis
RealPoor Jedi
RealPoor Jedi


Joined: 11 Oct 2002
Posts: 13293
Location: Moral Relativity Central



PostPosted: 01/24/05 - 18:09    Post subject: Reply with quote

You don't need to take a Microsoft approach and reinstall it. Read more about the settings and especially the default "AddType" values.

Must does the file extension be .html?
Back to top
kireol
RealPoor Master of Posts
RealPoor Master of Posts


Joined: 02 Aug 2003
Posts: 9517
Location: Royal Oak, MI



PostPosted: 01/24/05 - 18:18    Post subject: Reply with quote

microsoft way = ez way cuz you dont have to read if install was done right.
Back to top
cheese
Luke Warm
Luke Warm


Joined: 08 Dec 2004
Posts: 241



PostPosted: 01/24/05 - 18:23    Post subject: Reply with quote

right now I'm making them change the files to .php. php has been working fine on this box except for trying to do this, and why have the extra load with .html set as a php mime type anyhow.. I was trying to set it in an htaccess file so that only that directory would be affected by this, but who ever wrote the pages is agreeing on changing them to php. But as long as they end in php it works fine.
Back to top
gotissues68
RealPoor Sensei
RealPoor Sensei


Joined: 21 Aug 2003
Posts: 1866



PostPosted: 01/24/05 - 20:16    Post subject: Reply with quote

Occulis wrote:
You don't need to take a Microsoft approach and reinstall it. Read more about the settings and especially the default "AddType" values.

Must does the file extension be .html?


This made me LIRL ...
Back to top
gotissues68
RealPoor Sensei
RealPoor Sensei


Joined: 21 Aug 2003
Posts: 1866



PostPosted: 01/24/05 - 21:17    Post subject: Reply with quote

You need to add the following to your httpd.conf

AddType application/x-httpd-php .php .html

and remove the current line that references .html think its text/html or whatever for the mime type.

By the way, you realize that in doing this you are slowing down rendering of the files right? Every file regardless if it has any PHP or not will have to be parsed....
Back to top
Occulis
RealPoor Jedi
RealPoor Jedi


Joined: 11 Oct 2002
Posts: 13293
Location: Moral Relativity Central



PostPosted: 01/24/05 - 21:28    Post subject: Reply with quote

Usually that degraded processor time won\'t matter for hobbyists. It would be a bad move on a server getting a few dozen hits per second, though. Even tho that doesn\'t sound like a lot.

Posted from a mobile device
Back to top
Occulis
RealPoor Jedi
RealPoor Jedi


Joined: 11 Oct 2002
Posts: 13293
Location: Moral Relativity Central



PostPosted: 01/24/05 - 21:30    Post subject: Reply with quote

Usually that degraded processor time won\'t matter for hobbyists. It would be a bad move on a server getting a few dozen hits per second, though. Even tho that doesn\'t sound like a lot.

Posted from a mobile device
Back to top
kireol
RealPoor Master of Posts
RealPoor Master of Posts


Joined: 02 Aug 2003
Posts: 9517
Location: Royal Oak, MI



PostPosted: 01/24/05 - 21:34    Post subject: Reply with quote

depends on your layout and system. turning on SSI does degrade too. yet most sites have this on
Back to top
gotissues68
RealPoor Sensei
RealPoor Sensei


Joined: 21 Aug 2003
Posts: 1866



PostPosted: 01/24/05 - 21:35    Post subject: Reply with quote

well ssi using the .shtml extension specifically is fine and I'd hope thats the way its configured on most webservers but I'm sure some lazy people haven't done so. Dunn's right though on a box that doesn't do alot of traffic it shouldn't hurt anything.
Back to top
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1

Related topics: