All posts by admin

Weird characters in html page – chunked – output buffer

I noticed some weird code while checking a website (http://www.slotsmamma.com) via a html viewer, the following is the 
example of the characters,
 
 '197(CR)(LF)', '19a(CR)(LF)' or '19a(CR)(LF)'
 

I don't see anything wrong with the html, these characters seem only appearing when visiting the page from html viewer and telnet. From chatting with a Linux guru, we found that
 this happens because of the html being chunked up. 

------------------8<-----------------------
Receiving Header:
[...]
Transfer-Encoding:·chunked(CR)(LF)
[...]
------------------8<-----------------------

PHP uses a output buffer of off by default. I changed the php.ini and setup 4096 bytes for the output buffer, any page smaller than that will not get chunked.

Output buffering allows you to send header lines (including cookies) even after you send body content, at the price of slowing PHP's output layer a bit.  You can enable output buffering during runtime by calling the output buffering functions.  You can also enable output buffering for all files by setting this directive to On.  If you wish to limit the size of the buffer to a certain size – you can use a maximum number of bytes instead of 'On', as a value for this directive (e.g., output_buffering=4096).