Show
Follow the below steps to enable and disable PHP output buffering on your 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_buffering1. 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 [[email protected] /]# systemctl restart httpd 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_buffering1. Log into you Linux server as ‘root’ user 2. Run the command ‘php --ini’ to find the loaded configuration file
[[email protected] /]# php –ini | grep Loaded [[email protected] /]# vi /etc/php.ini Change the line ‘output_buffering = On’ to ‘output_buffering = Off’ 5. Restart the webserver for changes to take effect [[email protected] /]# systemctl restart httpd ‘output_buffering = 0’ means output_buffering is disabled. How to check whether PHP output_buffering is enabled or disabled1. 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 [[email protected] /]# grep output_buffering /etc/php.ini 4. You can also check output_buffering by creating phpinfo page in site document root output_buffering is enabled on the above linux server. Fungsi PHP Output Buffering Control
penyimpan hasil output. Aturan Penyimpanan:void flush (void) ; Contoh: <?php b. ob_flush( ) void flush (void) ; Contoh: <?php c. ob_get_contents( ) string ob_get_contents (void) ; Contoh: <?php d. ob_start( ) bool ob_start ([ callbackc $output_callback [, int $chunk_size [, bool $erase ]]]) ; Contoh: <?php e. ob_clean( ) void ob_and_clean (void) ; Contoh: <?php f. ob_end_clean( ) bool ob_end_clean (void) ; Contoh: <?php g. ob_end_flush( ) bool ob_end_flush(viod) ; Contoh: <?php |