Shared Know How

Howto: fix, find, use, make & do it guide

Optimize your PHP website performance

author Posted by: Tim on date Apr 16th, 2010 | filed Filed under: Other stuff, php, programming, webserver

Optimize your PHP website by making sure you use the following tricks

The list

Optimize front-end

  • Combine CSS files as much as possible
  • Combine Javascript files as much as possible
  • Always place a favicon.ico (saves needless 404 request and file searches)
  • If you use a lot of small images for your website make use of CSS Sprites
  • Use GZIP compression

Optimize PHP

  • Install APC (Alternative PHP Cache). This will speed your php up a lot
  • if you don't use .htaccess or have control over the server remove .htaccess ability and set any options in your apache virtual host file.
  • don't use current directory (".") in your include path but instead link directly to files in your code: include("./example.php")
  • Watch how many include paths you have. It will search in every folder for to find include file.
  • use persistent mysql connection (mysql_pconnect)

This list is based on the presentation of Rasmus Ledorf at Campus Party 2010 - Out of this e've compiled a small checklist of things to do when you create a php website. This will make sure you will use all the simple tricks to make your website and PHP code to run fast. Further information on how to benchmark this look at the presentation of Rasmus.

Did this help you? Wanna help too?

     Add A Comment

trackback Trackback URI | rsscomment Comments RSS