Many people are talking about somethings like accelerator, opcode, etc to speed up a website's performance. To be honest I do not know how to make any PHP website perform well and when do I need to use such things and what if I use them will that cost me a lot? I generally like websites to perform well with excellent and quick load time for the user (I know the load time has other factors such as the internet speed but what I care about here is the performance of the PHP code itself how to make it perform better).

So, could you tell me about all the ways to speed up any PHP website and whether they are possible and easy to implement or not?

4 Answers 4


You need to know what is slowing down the site most before you can effectively 'speed-up' a website.

Do some profiling and determine exactly where your biggest bottle necks are first and pick of the most effective low-lying fruit until you get your desired performance. Remember, you will experience the effects of diminishing returns, so you will have to find the point of maximum value for the particular case in hand.

Typical areas you will have are as indicated by @guiman in his answer.

I would also add in:

  • Hardware limitations

    • Are you being memory bound
    • CPU bound?
    • Waiting on the disk?
    • If any of the above, is the DB being run on a separate machine?
  • Network limitations

    • What is the utilization on the connect to the web server?
    • What is the latency like?
    • Potential to utilize a CDN to move traffic elsewhere?

If you think about performance, first thing come to mind is Cache, also i have read that its possible to compile php code, so that could be another way to go. But if you think PHP as a web application that involves Sql queries and lots of javascripts executing, you should start worring about how much time does any browser uses to load and execute each javascript and how much optimized your Sql queries are.

So my priorities to build faster PHP web applications would be:

  1. Sql queries
  2. Javascripts execution (ajax could be a real pain in the processor :P )
  3. Caching

    3.1 Object Cache if you are implementing some kind of OOP

    3.2 Page Cache

  4. Code optimization (algorithms, data structures and related stuff)

you can try using Zend Server and/or Squid.

Zend Server provides many other features like your php configuration setting, page caching and also optimizing your PHP codes. while Squid provide provide caching which will reduce bandwidth and deliver pages quickly (taken from the cache instead of requesting the server to run the page again)

  • Can you give more details please? Are they free and easy to install? All I need just to install them?
    – Goma
    Apr 8, 2011 at 2:11
  • Squid is free, and Zend server they have Community Edition (CE) which is free and there is also enterprise version. The CE already include the optimizer, but no caching features. I never install them before, so I'm not sure about the installation process. Try to browse through their websites.
    – Sufendy
    Apr 8, 2011 at 2:44

I mainly find perfomance issues in this two no so reviewed things :

Well then check the other things that guiman said! (sql queries,etc...)

Not the answer you're looking for? Browse other questions tagged or ask your own question.