Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

Thanks!

share|improve this question
add comment

1 Answer

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
</FilesMatch>

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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