I am taking over an application server and discover that it contain the following settings:

AddType text/html       php

Although it works, but my understanding is that it should set as following:

AddType application/x-httpd-php php .php

What are the key differences between the two settings? Although at this point my application (Built using CakePHP) is running fine with either configuration, but I am not sure if it will cause any strange behaviour.


1 Answer 1


The mod_mime AddType definition from the Apache httpd docs:

The AddType directive maps the given filename extensions onto the specified content type. MIME-type is the MIME type to use for filenames containing extension. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. This directive can be used to add mappings not listed in the MIME types file

In short AddType text/html php tells httpd to specify the Content-Type header for PHP files to be text/html. Which is correct since it is used by the client side browser and not the server itself.

What tells httpd to handle the files as PHP is the SetHandler directive:

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php

The PHP configuration instructions explain the SetHandler directive in relation to PHP as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.