Blog Sections Open

Sending Custom `header()` Responses from Evolution CMS Export Logic

If a download script must emit its own headers, the main task is to make sure nothing in the CMS boot process has already sent conflicting output.

The original example used a custom export flow with headers like:

header("Expires: Mon, 1 Apr 1974 05:00:00 GMT");
header("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=exim.xls");

and the key question was why MODX/Evolution was not sending them cleanly.

What Usually Breaks Header Output

  • whitespace or HTML output sent too early
  • bootstrapped CMS rendering continuing after the export logic
  • plugins or templates injecting output before the download starts

The practical pattern is to isolate export logic in a clean execution path, send headers first, emit only the file content, and stop the normal page render immediately after.

Newer post

Troubleshooting KCFinder Path Problems in Older Evolution Builds

A practical note on KCFinder issues caused by path settings, MCPUK integration, and mismatched base path assumptions.

Older post

Troubleshooting a File Manager That Stops Working in Evolution CMS

What to check when the file manager opens but stops listing images, folders, or uploads correctly.