-4

My site is running fine on one server but when I shifted it to another server, some pages are giving following warning message.

Warning: Cannot modify header information - headers already sent by (output started at /home/parviz/public_html/ganj_videos/lang/english.php:1) in /home/parviz/public_html/ganj_videos/mobile/detect.php on line 50

Any idea on how to fix it?

Thanks.

  • post your script, you probably have whitespace before sending headers – user1914292 May 14 '13 at 09:00
  • Duplicate of too many to count: https://www.google.co.uk/search?q=site%3Astackoverflow.com+headers+already+sent&aq=f&oq=site%3Astackoverflow.com+headers+already+sent&aqs=chrome.0.57j58.3727j0&sourceid=chrome&ie=UTF-8 – Quentin May 14 '13 at 09:00
  • Welcome to SO! Make sure to search around SO first in case this has been answered. Based on your comment it seems whitespace is not the issue if it works on one server and not the other. – davidethell May 14 '13 at 09:02

2 Answers2

0

Most likely your new server has a different setting for the errors and warnings. If PHP issues a warning or error as output then it will cause your headers to fail.

Change the level using the error_reporting function.

davidethell
  • 11,708
  • 6
  • 43
  • 63
0

Just follow the debug: it says output started in file /home/parviz/public_html/ganj_videos/lang/english.php on line 1. There's most probably some messy newlines or spaces there. Make sure all php files executed start with <?php and NOTHING else before it, or you'll get the warning.

Niels Keurentjes
  • 41,402
  • 9
  • 98
  • 136