Headers already sent by .....

Last update on December 21, 2008 09:11 AM by jak58
Published by jak58

Headers already sent by .....







When using PHP function that handles the HTTP headers such as:
header ()
setcookie ()
session_start ()



Consider, using these functions before they generated any information to the client. From the moment

information was sent to the client , it means that the HTTP headers have already been automatically sent to the

client. This type of feed is frequentwith the functions like echo, print, etc..

If there is a free space before the opening of the first php tag, then this space could be sent to the web client.

Here is an example of a head with the Kioskea homepage :


Server: Apache
X-Powered-By: Php/4.4.0-0.dotdeb.0
Keep-Alive: timeout=15, max=50
Connection: Keep-Alive
Transfert-Encoding: chunked
Content-type: text/html; charset=iso-8859-1


The aim is to understand how the system works:

When using echo or print at the beginning of a script and there a space in my script that is not included in my php tags, it will be considered as part of the source of the page to send and headers precede. This may cause an error.
The server sends this data preceded by headers as an html page.

If after this a function related to the headers is used in the script, it can no longer do so because the headers have already been sent. You should be prompted by the error message "headers already sent".
Best answers for « Headers already sent by ..... » in :
Structure of an email (Headers and bodies) Show Structure of an email An email has three basic parts: The header, a set of lines containing information about the message's transportation, such as the sender's address, the recipient's address, or timestamps showing when the message was sent by...
Bad Pool Caller/ Header Show Bad Pool Caller/ Header Issue Solution Issue If after launching an application , a blue screen appears on your screen displaying below error message : Bad Pool Caller Bad Pool Header Solution The error message or...
[Outlook Express] The message could not be sent (0x800c0131) Show [Outlook Express] The message could not be sent (0x800c0131) When you open up Outlook Express you get the following error message: An unknown error has occurred. Protocol: SMTP, Port: 0, Secure SSL: No, Error 0x800c0131Ce problem may be...
Request a Delivery receipt (Outlook / Thunderbird) ShowRequest a Delivery receipt (Outlook / Thunderbird) Get a receipt with Outlook Get a receipt with Thunderbird If you want to know if your email has been sent successfully to your recipient then you must activate certains options in in...
Outlook Express: The message was not sent (0X800C0131) ShowOutlook Express: The message was not sent (0X800C0131) Issue Solution Issue During the launch of Outlook Express, you receive the following error message: An unknown error has occurred. Protocol: SMTP, Port: 0, Secure SSL: No,...
[Myth] MSN Messenger is closing down! ShowMSN Messenger is closing down! Myth Reality Myth There have been many forwards sent to Internet users around the world, notifying them that soon MSN Messenger will close down and become a paid service. These emails have apparently been...
Data transmission - Transmission modes ShowTransmission modes A given transmission on a communications channel between two machines can occur in several different ways. The transmission is characterised by: the direction of the exchanges the transmission mode: the number of bits sent...
Data transmission - Introduction ShowData representation The purpose of a network is to transmit information from one computer to another. To do this, you first have to decide how to encode the data to be sent, in other words its computer representation. This will differ according to...
The HTTP protocol ShowIntroduction to the HTTP protocol Since 1990 HTTP protocol (HyperText Transfer Protocol) has been the most widely used protocol on the Internet. Version 0.9 was only intended to transfer data over the Internet (in particular Web pages written in...