Answers.Body: <p>After upgrading to 5.30 the error seems to be gone.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-03T20:19:44.180Z
Answers.LastActivityDate: 2020-11-03T20:19:44.180Z
Answers.UserDisplayName: nielo
Answers.Body: <p>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.</p>
  <p>Check civicrm.settings.php or extensions or files in the CMS that might have changed.</p>
  <p>You could also try running this from the root folder of your CMS:</p>
  <p><code>find . -type f -exec awk 'NR==1&amp;&amp;/^$/{print FILENAME}' \{\} \;</code></p>
  <p>or maybe this if the line isn't completely blank, like a couple tabs:</p>
  <p><code>find . -type f -exec awk 'NR==1&amp;&amp;/^\s*$/{print FILENAME}' \{\} \;</code></p>
  <p><a href="https://askubuntu.com/a/1072314">https://askubuntu.com/a/1072314</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-02T22:31:13.557Z
Answers.Text: 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.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-03T18:30:31.547Z
Answers.Text: Thanks, but I'm afraid this isn't the case. If I save the file, it's just a perfect csv.
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-03T19:13:41.853Z
Answers.Text: Demerit, what settings in civicrm.settings.php could cause this?
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-03T19:30:13.317Z
Answers.Text: It's not a setting. I've updated answer with something you can try.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-03T19:41:36.720Z
Answers.Text: Thanks! Shouldn't I rstrict this find to php files?
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-03T19:43:02.187Z
Answers.Text: You could. In drupal though sometimes they are called .theme or .module or .inc etc. I think wordpress also has .inc.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-03T20:10:07.177Z
Answers.Text: I just can't find anything suspicious.Do you have any more ideas?
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-02T12:52:34.697Z
Answers.LastActivityDate: 2020-07-03T19:29:55.703Z
Answers.LastEditDate: 2020-07-03T19:29:55.703Z
Answers.UserDisplayName: Demerit
Body: <p>We're facing an issue with contact exports. They become displayed in the browsers as raw text.</p>
  <p>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.</p>
  <p>Does anybody has the slightest idea what could be causing this?</p>
  <p>-- <strong>Update 2020-11-03</strong> --</p>
  <p>I'm stuck with this til today. I tried literally any detection method.</p>
  <p>And exporting reports works.</p>
  <p>When stracing apache for setting the header while exporting contacts or participants:</p>
  <pre><code>strace -fyp $(pgrep apache2|sed ':a;N;$!ba;s/\n/,/g') -s 30000 |&amp; grep -i 'Content-Disposition:'
  </code></pre>
  <p>I get no results.</p>
  <p>It would be too nice if anybody may shed some more light on this.</p>
  <p>-- <strong>/Update</strong> --</p>
  <p>Thx in advance</p>
  
Tags: <export><core>
Title: CiviCRM exports displayed in browser – no download / header missing
ThreadText: # CiviCRM exports displayed in browser – no download / header missing
  
  (Asked by: username_0 on 2020-07-02)
  
  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
  
  **Tags:** export, core
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-11-03. Score: 0 | Accepted answer
  
  After upgrading to 5.30 the error seems to be gone.
  
  
  ---
  
  ### Answer by username_1 on 2020-07-02. Score: 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}' \{\} \;`
  
  <https://askubuntu.com/a/1072314>
  
  > **Comments:**
  > **username_2**: 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.  
  > **username_0**: Thanks, but I'm afraid this isn't the case. If I save the file, it's just a perfect csv.  
  > **username_0**: username_1, what settings in civicrm.settings.php could cause this?  
  > **username_1**: It's not a setting. I've updated answer with something you can try.  
  > **username_0**: Thanks! Shouldn't I rstrict this find to php files?  
  > **username_1**: You could. In drupal though sometimes they are called .theme or .module or .inc etc. I think wordpress also has .inc.  
  > **username_0**: I just can't find anything suspicious.Do you have any more ideas?  
  
  ---
  
  