phpapachecentos6contaomod-filter

Difference between mod_ext_filter and mod_filter?


I installed PHP 5.6.17 on a CentOS 6.4 server using this guide. A Contao installation is running on that server. Contao comes with these directives in its default .htaccess:

##
# Gzip compression
# @see https://github.com/h5bp/html5-boilerplate
##
<IfModule mod_deflate.c>
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
    AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
    AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
  </IfModule>
</IfModule>

This enables the automatic Gzip compression. However, on that server I noticed that the mod_filter extension wasn't enabled by default, even though it should be part of the php56w-common package (see https://webtatic.com/packages/php56/). I did notice that there is a mod_ext_filter extension enabled though - I changed my directives accordingly (replacing mod_filter with mod_ext_filter) which seems to work.

I never saw mod_ext_filter before so I am wondering what's the exact difference between these two modules (and why the more common (?) mod_filter module wasn't available in the php56w-common package for CentOS).


Solution

  • "I changed my directives accordingly (replacing mod_filter with mod_ext_filter) which seems to work." I can't imagine what this possibly means, but the two modules use completely different directives and serve different purposes. mod_ext_filter allows you to write your filters in an external script of your choosing. mod_filter runs filters loaded from a compiled module.

    Apache Module mod_filter

    Description: Context-sensitive smart filter configuration module

    https://httpd.apache.org/docs/2.2/mod/mod_filter.html

    Apache Module mod_ext_filter

    Description: Pass the response body through an external program before delivery to the client

    https://httpd.apache.org/docs/2.2/mod/mod_ext_filter.html

    If – as I suspect – you aren't using either module, why load them at all?

    Edit: Are you referring to the PHP filtering module? If so, that's been built in to PHP since forever. Run php -m | grep filter to see it listed for yourself.