I've recently setup a new server for a site of ours running Ubuntu 12.04. I've installed the Apache, PHP and MySQL packages from the repository and done minimal configuration. The site is loading, however, the response is taking approximately 32 seconds to return. If I monitor the access log file, nothing happens for about 30 seconds and then all of the sudden the request shows up. I'm not an expert with Apache. Where could I start looking to diagnose this issue?

Edit: The site uses the Yii framework and memcached.

  • What is the response time like for a static html page? – HTTP500 Jan 29 '13 at 2:04
  • Static page is very fast ~300ms as are all the static files (images, css, javascript, etc.) – Matt McCormick Jan 29 '13 at 2:07
  • What filesystem is MySQL on? ext4? – HTTP500 Jan 29 '13 at 2:09
  • It's on ext3. I'm hosting the database on the same server. – Matt McCormick Jan 29 '13 at 2:10
  • 1
    Do a mysqladmin -i 1 processlist while you're waiting for the response in the browser. If the SQL query executes quickly then profile your PHP code. – HTTP500 Jan 29 '13 at 2:15

Check how you're connecting between Apache and MySQL. If you're connecting by name you may even have a DNS issue. Use either sockets or connect to For reasons I've never been able to properly investigate I see a lot of people having issues when connecting to localhost.

  • Thanks for the suggestion but no change. I think it must be an issue with the PHP code and/or setup. – Matt McCormick Jan 29 '13 at 2:43

Turned out this was a problem with the session save_path. It was using Memcache but configured for the wrong port on the new server. Fixing that fixed the problem but running the profiler for the PHP code helped identify that the session_start was the culprit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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