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.
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
127.0.0.1
. For reasons I've never been able to properly investigate I see a lot of people having issues when connecting tolocalhost
.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.