title: Warning: Cannot modify header information - headers already sent by
body: <p>When i try run this file i am getting this error.</p>
  
  <pre><code>&lt;?php
  
  $im = imagecreatetruecolor(100, 100);
  
  // sets background to red
  $red = imagecolorallocate($im, 255, 0, 0);
  imagefill($im, 0, 0, $red);
  
  header('Content-type: image/png');
  imagepng($im);
  imagedestroy($im);
  ?&gt;
  
  Warning: Cannot modify header information - headers already sent by (output started at C:\xampp1\htdocs\check\2.php:1) in C:\xampp1\htdocs\check\2.php on line 7
  �PNG  ��� IHDR���n������V,����PLTE����[an����fIDAT�c`�`fx���`Ǡ����41����˖ݒ�q�@੤;{á0� �i 
  </code></pre>