What's happening in our world

Blog Post
Speed Up Your Site With Effective PHP Use
Even in the older days of the web, application developers could not afford to be ignorant of SEO practices - but in today's world, it's a vital skillset for maintaining relevancy. One of the most neglected aspects of SEO is page load time, and the way your PHP code is written can make a huge difference in the speed your users (and the Google search spiders) experience. Obviously, one of the most effective things to do is ensure you use a high-quality hosting provider, but this isn't always an option. Fortunately a couple of simple tips and tricks in PHP can make a huge difference in load times, so lets take a quick look at the most popular methods.
 
One of the most useful things you can do, especially when you're writing extensive code segments, is to employ a simple PHP caching system. This is especially helpful when there isn't a heavy amount of reparsing required for each user navigation step, as it lets you skip the reparsing step. If, for example, the user is navigating through a large number of database entries, simply dump the output from your first parse into an html file, and display that to the user when they revisit the same page in the same session. This can dramatically reduce the load on your server from numerous database queries, and can make a huge difference in your user experience.
 
Next, take a good long look at the external requests your site is making. A growing trend among websites is to pull lots of data from different sources - Twitter feeds, news stories, popular blog comments, etc - but it's important to not let this tendency get ahead of us. This is especially true when you're working on code for a Wordpress or similar-style blog, as the ease of incorporating PHP widgets can make some developers cram far too many requests onto a single page, dramatically increasing load time.
 
Finally, and probably most helpfully, use a program called Minify on your server. Minify is a free tool that combines your site's various Javascript and CSS files into a single file, removes comments and whitespace, and then compresses the whole thing with gzip. This simple step can increase the load time of your CSS/Javascript by as much as 75%, which is a huge difference in terms of user experience - and Google search spiders also appreciate it.

If you're feeling adventurous, it's possible to use PHP to compress your CSS and other files, but we'll save that for another post - you should be able to see a large difference in your load times just from these simple tips.
Sign up to receive updates from SourceGuardian
Try our free php source code demo
TRY SOURCEGUARDIAN FREE FOR 14 DAYS
Account Login:

login Forgotten Password?
Connect with us
Bookmark
facebook linkedin twitter rss
© Copyright 2002 - 2024 SourceGuardian Limited
Privacy Policy l Terms & Conditions l Company Info l Contact us l Sitemap l PHP Weekly News