Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

closed as not constructive by gnat, thorsten müller, Walter, Thomas Owens Nov 28 '12 at 12:35

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

4 Answers

up vote 2 down vote accepted

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?
share|improve this answer
add comment

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)
share|improve this answer
add comment

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)

share|improve this answer
    
Can you give more details please? Are they free and easy to install? All I need just to install them? –  Goma Apr 8 '11 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. –  Phelios Apr 8 '11 at 2:44
add comment

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

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

share|improve this answer
add comment

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