We're facing an issue with contact exports. They become displayed in the browsers as raw text.

We recently updated to php 7.1 and CiviCRM 5.25.0 but unfortunately and due to infrequent use of the export functionality we can't say if any of these changes directly led to the problem.

Does anybody has the slightest idea what could be causing this?

-- Update 2020-11-03 --

I'm stuck with this til today. I tried literally any detection method.

And exporting reports works.

When stracing apache for setting the header while exporting contacts or participants:

strace -fyp $(pgrep apache2|sed ':a;N;$!ba;s/\n/,/g') -s 30000 |& grep -i 'Content-Disposition:'

I get no results.

It would be too nice if anybody may shed some more light on this.

-- /Update --

Thx in advance

2 Answers 2


If you have something like a file with a blank line at the top that might get output before the export data and cause the output to be interpreted as http content-type text instead of a download.

Check civicrm.settings.php or extensions or files in the CMS that might have changed.

You could also try running this from the root folder of your CMS:

find . -type f -exec awk 'NR==1&&/^$/{print FILENAME}' \{\} \;

or maybe this if the line isn't completely blank, like a couple tabs:

find . -type f -exec awk 'NR==1&&/^\s*$/{print FILENAME}' \{\} \;


  • Agreeing with this - I find that usually the problem is a blank line introduced in a theme. A quick way to isolate the problem is to change to a stock theme and see if the problem persists. Jul 2, 2020 at 22:31
  • Thanks, but I'm afraid this isn't the case. If I save the file, it's just a perfect csv.
    – nielo
    Jul 3, 2020 at 18:30
  • Demerit, what settings in civicrm.settings.php could cause this?
    – nielo
    Jul 3, 2020 at 19:13
  • 1
    It's not a setting. I've updated answer with something you can try.
    – Demerit
    Jul 3, 2020 at 19:30
  • Thanks! Shouldn't I rstrict this find to php files?
    – nielo
    Jul 3, 2020 at 19:41

After upgrading to 5.30 the error seems to be gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.