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

Share this Article :

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. In this post, i will show how turn off or disable output buffering for php.ini on PHP 5.3.2. This steps has been tested on the Red Hat Linux Enterprise 6 (RHEL 6) 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.

Also Read :   How to Properly Shutdown Linux CentOS/RHEL Server

1. Open /etc/php.ini :

[[email protected] ~]# vi /etc/php.ini

In PHP 5.3.2, 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 :

output_buffering = 4096

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

;output_buffering = 4096

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

[[email protected] ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

Leave a Reply