penders

msg:4422570 | 10:03 am on Feb 28, 2012 (gmt 0) |
AddType and AddHandler are to do with the Apache webserver, not really PHP. You might be using these commands to instruct the server to parse certain files for PHP? What was the full AddType / AddHandler statements?
|
wilderness

msg:4422597 | 11:52 am on Feb 28, 2012 (gmt 0) |
What was the full AddType / AddHandler statements? |
| (per the script instructions) AddType x-httpd-php .html (changed to) AddHandler x-httpd-php .html
|
penders

msg:4422638 | 1:18 pm on Feb 28, 2012 (gmt 0) |
As I understand it AddType tells the browser what mime-type the specified file extensions should be - in other words telling the browser how to handle the file. AddHandler, on the other hand, tells the server how to process files with the specified file extensions. They do different things. In your case (with AddHandler) you are telling the server to send all .html files through the PHP engine. | AddType x-httpd-php .html |
| This looks wrong to me, I don't believe "x-httpd-php" is a valid mime-type and this probably explains your Windows error message. If anything (IMHO) it should be "application/x-httpd-php"... AddType application/x-httpd-php .html However (and this is where my server knowledge is flagging - so if someone else can please explain), despite seeing examples of this all over the web, I don't know why AddType would be required in this way. AFAIK the default mime-type for .html files is text/html which I would have thought would be OK?
|
wilderness

msg:4422645 | 1:43 pm on Feb 28, 2012 (gmt 0) |
| AddType application/x-httpd-php .html |
| This is actually what the script instructions specified, however the script would not function with this line. Did a google and went through plenty of references before locating one in which suggested removing application. The script functioned fine after that. Many thanks for your help.
|
g1smd

msg:4422751 | 6:44 pm on Feb 28, 2012 (gmt 0) |
The AddType / AddHandler stuff is beyond confusing and I usually end up trying several combinations before I find the one that works OK.
|
Key_Master

msg:4422790 | 7:26 pm on Feb 28, 2012 (gmt 0) |
On some server configurations, both directives need to be implemented.
AddType application/x-httpd-php .php .html AddHandler application/x-httpd-php .php .html
|
SteveWh

msg:4423169 | 5:33 pm on Feb 29, 2012 (gmt 0) |
My understanding is that penders's description of what the two directives are supposed to do (and what they're for) is exactly right, but in some Apache versions it is necessary to use a workaround to achieve the desired effect on the server, which leads to the many variations of the two lines that you find. Some configurations require AddType, others AddHandler, and others require both. And the precise syntax required for each line also varies with version/configuration. First look for a FAQ or KB page at your host with explicit instructions for their servers (usually titled something like "parse html files as php"). If none found, search online for forum posts by other users of your webhost describing what worked for them. If none found, use random examples you find online and experiment until one works.
|
penders

msg:4423198 | 6:31 pm on Feb 29, 2012 (gmt 0) |
| Some configurations require AddType, others AddHandler, and others require both. |
| I just had a quick go on my local test server which runs PHP as an Apache module and I am required to use AddType (not AddHandler) in a per directory .htaccess file in order to get .html files processed by PHP, of the form... AddType application/x-httpd-php html (The mime-type is somehow transmogrified into text/html when sent to the client.) I have read that if you run PHP as CGI then you will need to use AddHandler instead. (It's funny, in my head it feels like it should be the other way round!? But as mentioned... confusing!)
|
|