Linux : Install file_cache_module.so on CentOS/RHEL6

By | June 14, 2014

Since CentOS/RedHat Enterprise Linux 6, “mod_file_cache”, commonly referred as “MMapFile” too is no longer provided with Apache binary. File Cache module statically map file pages into memory.

This module is still experimental according to Apache documentation, which may explain why it’s not included, even though it was included in CentOS/RHEL5.

You may get the following error output trying to reload or restart apache when you have a “MMapFile” statement in your configuration and the module missing from your system :

Invalid command ‘MMapFile’, perhaps misspelled or defined by a module not included in the server configuration

You can add the module to your system keeping the stock binary package and avoid mixing 3rd party RPM repository. Just follow these steps.

1. Install the required development packages :

2. Get your current running Apache version :

(CentOS/RHEL 6.5 should output the following : httpd-2.2.15-30.el6.centos.x86_64)

3. Get the Apache source matching your running version from the archive download repository :

http://archive.apache.org/dist/httpd/

(this example would require the following package : http://archive.apache.org/dist/httpd/httpd-2.2.15.tar.gz)

4. Go to the module directory :

5. Build the module :

All done, the module has been compiled and added in httpd.conf.

6. Check your configuration :

If no error output, then reload the configuration :

NOTE : Optionally if you do not need them anymore, you may now remove the development packages and their dependencies we’ve installed in the beginning as followed :