Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a small LAMP-based web server on which PHP-based pages seem to take a minimum of 5 seconds to render.

I believe that the problem is some issue with my PHP configuration in particular because:

  • requests for static pages take 0.5s or less to satisfy
  • requests for saved, static versions of PHP pages are served as fast as other static pages
  • requests for PHP-based pages take >5s to satisfy whether or not they make requests to the DB
  • the delay persists whether accessing the server by hostname or by IP, so it's not a DNS issue
  • looking at vmstat during the request shows 0 for swap-in and swap-out, so it's not pagefile thrashing
  • looking at top during the request shows that no apache process gets above 2-3% of CPU time, so it's not limited by CPU performance
  • looking at the apache logs during requests shows a GET request for the PHP-based page, a 5-second delay, and then a request for the first CSS file that the PHP page loads.

On that basis, I feel pretty sure that the problem is with the PHP configuration, but PHP configuration is foreign to me. What are my options for improving PHP performance here? What are some common problems I should check for?

The main use case for this server is running a site based on the Joomla CMS, but this problem appears to be independent of Joomla, because the performance problems are happening with all PHP pages.

A clarification in response to Zoredache's question:

share|improve this question
Downloading a static page really takes up to 0.5 seconds, that seems pretty high. And a single page view takes 5 seconds for a PHP page? How are you measuring the delay? Does that delay still happen if you use curl/wget locally on the webserver. – Zoredache May 25 '11 at 23:23
I measured those times by using time curl $foo for a variety of pages. – Brighid McDonnell May 25 '11 at 23:31

Rasmus (Creator of PHP) did a whole talk on PHP performance (There's a video of him doing the talk somewhere but I can't remember where, if I find it I'll update this post)

The video is here

share|improve this answer
While that's interesting, that's not really an answer. – Brighid McDonnell Dec 9 '11 at 0:08

Are you using DNS names for resource addresses, such as the DB server address ? If so try replacing them with IP Addresses and see if the speed improves. This is a possible quick win.

Otherwise I suggest you try using to find your bottleneck

share|improve this answer
Yes, but I'm just getting started :) – Cillier Oct 10 '13 at 11:37
@LorenzMeyer This is not a forum. Good answers are welcome at any time. – Michael Hampton Oct 10 '13 at 16:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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