How to improve PHP page downloads
I wanted to play with the buffering capabilities of PHP and tested it on my site http://www.careercurry.com.
I wanted to use it to improve the site performance and download times for my site and hence implemented GZIP compression on the home page and my article pages.
To improve your site performance implement the following steps on your pages. I recommend creating a copy of a page that you want to test and implement changes on the copy before you implement it on the actual page. Also try these changes on one page before you go live on the entire site.
1. In the beginning of your script write the following code:
In the above code, ob_gzhandler is a function provide by PHP which accepts a string as input and returns gzipped data. Therefore, you set ob_gzhandler() as a call back function to ob_start() function. The call back happens after a call to ob_end_flush() is made in the script.
2. At the end of your script; write the following code:
That’s it, you are done.
Let me know if you have any questions or comments