How to Turn Off or Disable Output Buffering for php.ini on PHP 5.3.3

In this post, I will show how turn off or disable output buffering for php.ini on PHP 5.3.3. Output buffering is used by PHP to improve performance and to perform a few tricks. PHP will send buffer to browser every get_opt(‘output_buffering’) bytes. Turning on output buffering alone decreases the amount of time it takes to download and render our HTML because it’s not being sent to the browser in pieces as PHP processes the HTML. For information, this steps has been tested on CentOS 5.8 server. This steps may also working on other versions such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5, CentOS 5.6, CentOS 5.7, CentOS 6.x and RHEL 5.x.

1. Open /etc/php.ini :

[root@centos58 ~]# vi /etc/php.ini

In PHP 5.3.3, output_buffering’s directive is set to ‘enabled’ or ‘On’ with buffer size 4096 by default. It’s on line 264 on /etc/php.ini file :

; http://www.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering
output_buffering = 4096

2. In order to disable or turn it ‘off’, you have to comment out the line 264 as below :

; http://www.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering
;output_buffering = 4096

3. Don’t forget to restart httpd service to take effect immediately :

[root@centos58 ~]# /etc/init.d/httpd restart