On Tue, 25 Jan 2005 17:15:19 -0200, Bruno Torres <[EMAIL PROTECTED]> wrote:
> I know that the PHP documentation tell you to use AddType, but the
> correct to use should be AddHandler.
> Yes, I know, AddType works, but AddType is used to inform the user
> agent how to treat a file with some extension. AddHandler though is to
> inform the server how to _hadle_ a document.

Both AddType and AddHandler are instructions for the Apache server, not for the
user agent. Instruction for user agent is sent by the server in
Content-type: header.
AddType denotes MIME type of the php file, and php module knows
what it should take care of  application/x-httpd-php files. After processing 
php module returns result - plain html to the browser with correct text/html
MIME type, so it is correct to use AddType.

> In the case of PHP, the AddHandler directive will tell apache to treat
> all .php (or, in the case .html) files as application/x-httpd-php
> i.e., use the PHP module to parse the file and deliver to the browser
> with the correct MIME Type.
> So, AddType denotes a MIME Type and AddHandler denoter, uh, a handler.
> The correct woud be using:
> AddHandler application/x-httpd-php .php .html

This is, in fact, incorrect, because AddHandler should be given not
MIME type, as you
do in your example, but handler name, such as: cgi-script,
server-info, server-status etc,
Handler name for the php is php-script for PHP4, or php5-script for PHP5.
The whole thing should look like:

AddHandler php5-script php
AddType text/html php

This is valid for Apache2.
However it is recommended to use AddType, and use AddHandler when you
want to use MultiViews with php.

Regards,
Rimantas
--
http://rimantas.com/
******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to