Use PHP Flush To Improve Site Loading Speed

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.

PHP Flush Site Speed

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.

31 thoughts on “Use PHP Flush To Improve Site Loading Speed”

  1. 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???

    Reply
  2. Nice tip buddy… but will it make any prob with my existing caching plugin ? (hypercache)

    Reply
  3. But Which file should I edit to add this code, is it style.css(the stylesheet) or the Index page template???

    Reply
  4. 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 ๐Ÿ˜‰

    Reply
  5. Sounds too good and simple to be true. Will definitely give it a try to see if it works. Thanx for sharing this.

    Reply
  6. 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

    Reply

Leave a Comment