CARMA contains support for X-Sendfile, which allows your web server to play back or serve your gallery/video content without the file's transmission being subject to PHP timeouts or memory limits.
X-Sendfile provides the feature of sending your gallery content or video content files directly to your users, which eliminates PHP from the process.
Using X-Sendfile can help to greatly improve your server's performance when working with CARMA, especially if you are directing large amounts of traffic through your site(s) or have extremely large content files (greater than 500MB per file).
The process of setting up and configuring X-Sendfile differs depending on what type of server you have set up. Currently, X-Sendfile only offers support for Apache and Lighttpd. The following explains the setup of both Apache and Lighttpd:
X-Sendfile in Apache
If you wish to use X-Sendfile in Apache, you must first install the module mod_xsendfile. Once you have installed that module, you must add the following lines to your .htaccess file or Apache configuration for each site you have set up in CARMA:
- If mod_xsendfile version is 0.10 or greater
- XSendFile On
- XSendFilePath /path/to/carma/cms_data
- If mod_xsendfile version is below 0.10
- XSendFile On
- XSendFileAllowAbove On
X-Sendfile in Lighttpd
Lighttpd already contains built in support for X-Sendfile-- however, this feature is usually disabled by default. In order to enable X-Sendfile, you will have to set the following parameter:
- fastcgi.server = ( ".php" => (( ..., "allow-x-send-file" => "enable" )) )
X-Sendfile in CARMA
Once you have made sure that X-Sendfile is enabled for your server by following the above instructions, you will have to set the following CARMA configuration variables in your config.php file:
- For video support:
- $config['USE_XSENDFILE'] = 1;
- For image support:
- $config['USE_XSENDFILE_IMAGE'] = 1;