 <p>I came with the same problem and my friend I found a quick solution for this.</p> <p>You have to just add a single line before your code.</p> <pre><code>ob_clean(); $ical = "BEGIN:VCALENDAR VERSION:2.0"; </code></pre>