Headers Already Sent !

Many people working with PHP would have encountered this very annoying “headers already sent” error, when working with Cookies or Sessions. This error appears, when some HTML output is sent, before the session/cookie handling begins.


Most of the Time, an Extra character before the PHP Tag is the reason. Even an Extra space before the PHP starting Tag, will Trigger is annoying error. Now, It may appear that even if there are no additional characters before the Tag, the error still appears ! Sounds, Fishy right ?


This may happen due to the Text editor that is used to Edit the php file. Probably, the Text editor inserted some additional character, which generated this error. Ah, that last one was the one I had to face.

I finally figured out the the Encoding of the file was the main reason. I had save the file as UTF-8 encodiung in the editor. The editor added extra information (BOM) at the beginning of the file, to identify the encoding as UTF-8.


There was noway, that I could the file as plain Text, I worked with Multi-Lingual Text. Everything would become appear as question marks if I had to force plain text.  Luckily, Editors like Notepad++ provide the option to save the file in UTF-9 without BOM. Presto ! problem solved :-). So, if you are working with multilingual PHP files, always save in UTF-8 without BOM.


[Another instant and dirty work-around is to save the entire body portion of the PHP as a separate PHP file with UTF encoding, and include it in the main file 🙂 ]


So, if any of you guys any such issues try the above, probably it wold clear the issue.

Wapache for Desktop PHP applications

At some point of time, some of us would have had the necessity run the Web Application we have developed in desktop, offline. Also Everyone would definitely like their App to run on desktop too.


To do this, there is a tedious process of installing a local copy of WAMP, and then using localhost to run the App in the web browser. An average user cannot be expected to go through all this hassle to run the App.


Instead of going through all this, there is a package called “Wapache” to create Desktop Applications from the existing code without any modifications, instantly. 


Continue reading