
Use PHP Flush To Improve Site Loading Speed
- Updated On 17/04/2017
- Author : Pradeep Kumar
- Topic : Tips and tricks
- Short URL : https://hellboundbloggers.com/?p=21777
CONNECT WITH HBB ON SOCIAL MEDIA
Ever since Google started to consider site speed for search rankings, webmasters and bloggers started to improve site loading speed.
You can check the best tools to improve site loading speed, FYI, you can also use Google Analytics to check site speed.
Why To Add PHP Flush Function?
PHP function flush() allows you to send your partially ready HTML response to the browser so that it will start to fetch the components while your backend is still busy with the rest of the HTML page. You can experience this effect when you have busy backends or light frontends.
Though the speed increase will actually depend on the server-side processing, page weight, and size of your CSS files. It is a simple optimization, and nothing wrong in doing it.
Where To Add PHP Flush Function?
To allow the browser to fetch CSS and JavaScript files in parallel, without disturbing the backend, it is recommened to use the function <?php flush(); ?> in between </head> and <body> tags. If you are using WordPress, then you have to edit header.php file probably.
</head>
<?php flush(); ?>
<body>
This is a simple tweak, and do tell us if this works for you.
Want to discuss your queries and interact with experts? You can connect with HellBound Bloggers (HBB) Facebook group for free!
Join HellBound Bloggers (HBB) and get Instant Updates. We'll also notify you with Great Deals, Discounts and other Interesting Tips. We won't SPAM or SHARE your Email Address with anyone.
YOU CAN ALSO SEARCH FOR YOUR DESIRED TOPICS:
Thank you for reading! We welcome and appreciate your comments, but at the same time, make sure you are adding something valuable to this article. If you have any serious queries, suggestions or anything related to this article, feel free to share them, we really appreciate that.
But, if your blog comments are a random "Thank you", "Useful Post", or anything that doesn't actually upscale the article, then we'll be removing them and it won't be appeared below. Thanks for understanding and thanks for connecting with us. If you want to give us any feedback or report any errors, you can kindly contact us and we'll revert back soon.
- Comments
- Facebook Comments
-
Comments
Leave a Reply
31 Comments
Facebook Comments
gary
hi,,,,its not working in blogger,,,when i save it,,,it says that template is not well build,,,so it fails
do you have any method for increasing blog load speed in blogger???
Renji
Hey Pradeep, are you still using PHP Flush? I read this: http://goo.gl/1wZgh on stackoverflow. How was your experience with it?
S.Pradeep Kumar
Hi Renji, thanks for sharing that. I'll take a look. ๐
Kostas @ Moserlx
Nice tip, thanks for sharing. I just added in my website and I will report back with results.
Jasmine
This is easy enough. But I wonder if it really improves on the speed?
S.Pradeep Kumar
Jasmine, this simple tweak is recommended by Yahoo! for better performance. ๐
http://developer.yahoo.com/performance/rules.html#flush
Jojo Mathews @Around Social
Nice tip buddy… but will it make any prob with my existing caching plugin ? (hypercache)
S.Pradeep Kumar
Hi Jojo,
I didn't face any problem with my caching plugin. I use W3 Total Cache. My clients, they use Super Cache, didn't face any either. ๐
Shawn
But Which file should I edit to add this code, is it style.css(the stylesheet) or the Index page template???
S.Pradeep Kumar
Shawn you should add this to header.php file. ๐
Rohit Batra
implementing it right now..will check it out how it works..
fouzan@WPSubscribers Review
one of teh simplest thing which works indeed ๐
sly
How do i implement this on blogger.Just state it in simple way,while i try to work on this
S.Pradeep Kumar
Sorry mate, Blogger blogs will not be able to implement this. ๐
Udegbunam Chukwudi
Remember I said I had doubts about adding it to my theme but I just did and everything still works fine on my hand. Do please be kind enough as to check if it loads fine on your end. Thanks man ๐
Nasif
How will I add it on thesis theme ?
Rohit Batra
there is a Head.php file in Thesis also under lib>>classes folders you can add it to that file.. I have not tried it..
S.Pradeep Kumar
In header.php file mate.
Karan Labra
Will give it a try…
Maninder @ HackTik.com
Sounds too good and simple to be true. Will definitely give it a try to see if it works. Thanx for sharing this.
Shashank
But have to add in which file of wordpress? Stylesheet or other. Please help as I am newbie.
S.Pradeep Kumar
Buddy, you need to paste this on header.php file. ๐
Shashank Joshi
Ok. Thank You I will try it out.
Iphone Blogger
anybody tried that ?
S.Pradeep Kumar
Many sites! QuickOnlineTips and HBB for example.
liaqat
going to try this….thanks for sharing Pradeep ๐
machbio
will try this..
Riya @ Couponseasy
It's so simple… Let me try it. I hope it really work on my site too.
Sunil Jain
Well this is a nice tip buddy ๐ , guess we all 've to give our best to make our blogs load faster ๐
Happy Fast Blogging ๐ lol
aswin
Nice one
Will deinetly give a try
Pulkit Kaushik | TheDolt
Implementing it now. Let's see if any noticeable improvements take place.