RSS Feed!

About me

I am a business intelligence developer working at Bizware since August 2015. In this blog I will present code samples, primarilly in tsql but also findings in all other parts of the Microsoft BI-stack.


Disclaimer: All code should be considered as "as-is", i.e. badly tested and not working until extensive testing have been made by anyone reading the code. :)


Happy coding!

Solution to “Cannot modify header information – headers already sent”

Hi!

This problem seems to occur on a frequently acting basis, so I’ll try to make a summary of the several solutions you can find on the net here:

Solution nr 1: Trim whitespaces near your start-tag in php, so it looks like this:

session_start();
/* After trimming whitespace, write out your header and the rest of your code */

Solution nr 2: header() is coming after require/include

session_start();
/* Try to make requires/includes compile after header */
header("Location: http://www.yoursite.com/mypage.php");

include("helperClass.php");
//code here

3. Or the pandoras box-solution: change the coding of the current file from UTF-8!
Sometimes (I don’t know for what reason) apache can’t read UTF-8 properly and think of the start-tag as other characters.

/*
#1: Open your file in a text editor (i recommend notepad++ or notepad)
#2: Change the coding of the file from UTF-8 to ANSI.
#3: Save and upload it to the server again.
*/

That’s summarises the top 3 solutions for this type of problem. There’s probably more solutions, but in order to find them, you need to dig deep into the search engines.

Tags: , ,

By | 15. Nov 2009 | Apache, English, Server | No Comments »

Leave a Reply