mod_xsendfile is a small Apache2 module that processes X-SENDFILE headers registered by the original output handler. If it encounters the presence of such header it will discard all output and send the file specified by that header instead of using Apache internals including all optimizations like caching-headers and sendfile or mmap if configured. It is useful for processing script-output of e.g. php, perl or any cgi.

To install xsendfile module you need to follow this steps :

Install dependencies needed for building the module :

yum install libtool git apr apr-devel apr-util apr-util-devel -y

Compiling/Installing xsendfile with CWP-Apache

cd /usr/local/src
rm -rf mod_xsendfile
git clone
cd mod_xsendfile
/usr/local/apache/bin/apxs -a -i -c mod_xsendfile.c

Usage :
for enabling xsendfile for all php use this in .htaccess :

<IfModule mod_xsendfile.c>
  <Files *.php>
    XSendFile On
    XSendFileAllowAbove On