Using the PHP flush method in your website

For those of you looking for greater speed when it comes to website loading times all you need to do is “flush”. A good number of people who are running websites today use PHP to do so.

What you probably didn’t know is that you can use the flush method to clear the buffer when your web page loads because after all slower web page loading times mean fewer visitors and a higher bounce rate. It’s all about keeping those “fans in the stands” when you are developing websites for human consumption.

Using the flush() method

It’s a relatively simple piece of code to use…

  1. Simply locate the head section of your website (Usually noted by the and HTML tags)
  2. Place the following code after the end of the < head > HTML tag…
      ... <!-- css, js -->
    </head>
    <?php flush(); ?>

    <body>
      ... <!-- content goes here!-->
  1. Its Rock N’ Roll time! Now your web pages will flush every time during a page load

I hope that you found this useful for your website and speeding up the performance on your PHP website.

9 Reasons why your website is slow

Why oh why is my website slow?  If you’ve ever asked yourself this question then you know how frustrating it can be when your website loads really slowly and with visitor frustration being a cause as to website’s success or failure and increased bounce rates, it makes sense that you want your website to load as fast as humanly possible.  Before you call the professionals (myself included) perhaps it’s best to take a moment and understand some issues plaguing website performance currently.

I’ve put together a brief list of common easy fix problems that point to slower website performance

  1. Put CSS style sheets at the top of your web pages
  2. Make JavaScript and CSS external to your web pages
  3. Reduce DNS lookups
  4. Avoid using redirects
  5. Remove duplicate scripts
  6. Flush the buffer early
  7. Minimize the use of iFrames
  8. Optimize image files on your website
  9. Don’t scale your images using HTML

If you are looking for information to help you get your website speedier check out this article from the Yahoo Developers Network called “Best Practices for Speeding Up Your Web Site”.  Also, check out there YSlow FireFox add-on that works with Firebug to diagnose your website’s performance problems.  I hope that you use this information to get your website running faster so that more people can see it!

Luc