How to Enable and Disable PHP output buffering
How to Enable and Disable PHP output buffering on Linux server
PHP output_buffering is used to keep some data in memory instead of sending it to web browser.
Output is stored in memory for some time and it is sent to the web browser when the script execution is completed.
How to Enable PHP output_buffering
1. Log into your Linux server as ‘root’ user or login as any user with sudo privileges
2. Find the path of php.ini by running the command ‘php --ini’

Find and edit php.ini
3. Open php.ini using vi editor and change ‘output_buffering = On’ in php.ini file

How to Enable PHP output_buffering
4. Save the php.ini file and exit
5. Restart the web server
6. Create phpinfo page to verify output_buffering is enabled

phpinfo – output_buffering enabled
‘output_buffering = 1’ means output_buffering is enabled and buffer is unlimited (Use with caution)
You can set custom value for output_buffering. Example : ‘output_buffering = 4096’

How to set custom value for output_buffering
How to Disable PHP output_buffering
1. Log into you Linux server as ‘root’ user
2. Run the command ‘php --ini’ to find the loaded configuration file
Loaded Configuration File: /etc/php.ini
3. Change the line to ‘output_buffering = Off’ in php.ini file
Change the line ‘output_buffering = On’ to ‘output_buffering = Off’
4. Save the php.ini file and exit
5. Restart the webserver for changes to take effect
[root@server /]# systemctl status httpd
6. Create phpinfo file to verify output_buffering is disabled
‘output_buffering = 0’ means output_buffering is disabled.
How to check whether PHP output_buffering is enabled or disabled
1. Log into your Linux server as ‘root’ or sudo user
2. Run the command ‘php --ini’ to find the PHP configuration file
3. Grep ‘output_buffering’ in PHP configuration file
; output_buffering
output_buffering = 4096
; performance, enable output_buffering in addition.
4. You can also check output_buffering by creating phpinfo page in site document root
output_buffering is enabled on the above linux server.