Over the weekend, I had the pleasure of upgrading one of my sites from Wordpress 2.7 to Wordpress 2.7.1. Everything appeared to be going smoothly, as automatic upgrade worked behind the scenes to bring Wordpress up to date. When the upgrade was complete everything in my admin panel looked fine, and was fully functional.
However, when I went to check the site itself there was a problem. The front page wasn’t being served, however when visiting the site from an inbound link to an individual post, the site appeared fine.
I went through the normal gauntlet to make sure that the problem was actually with my site. I cleared the cache in Firefox and Internet Explorer and even tried accessing the site through a proxy. All three times, the browser wasn’t able to resolve the front page.
I decided I would leave the site be for a while as for some reason, issue like these sometimes resolve themselves. Umm, not the case here.
On Sunday, the site front page was working, but guess what? The site was crashing every 45-60 minutes! I tried deactivating all of the plugins, and nothing changed. However, I did notice that restarting Apache would bring the site right back up again. As the day went on, the time in between crashes got smaller and smaller, until it was at the point that the site couldn’t be live for more than 30 seconds.
I decided to enlist the help of my host Media Temple. From what they could see, something was generating open connections in MySQL and the connections were not closing. As these open connections piled up, they ultimately lead to the site crashing.
Media Temple suggested that I make some adjustments using SSH, such as increasing the maximum connections to 250 with the hope that it would give the server more time for the connections to close. Nope, that didn’t help, but I sure had a lot of fun reading the documentation on shell commands.
Now before I get to the solution, here are two of the errors I was seeing:
When visiting the site, I was getting the error message “error establishing a database connection“. I would then restart Apache, and in my Plesk control panel I would see…
*Service is not available now, probably your Plesk is misconfigured.
Contact Your provider for details.
Internal Plesk error occurred: Unable to connect to database: mysql_connect() [< a href='function.mysql-connect'>function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)*
1. Disable wp-cache (super or original) from the WP Admin screen.
2. Stop Apache
3. Delete the entire wp-content/cache directory, as well as the wp-content/wp-cache-config.php and wp-content/advanced-cache.php files
4. Delete the wp-content/plugins/wp-cache and/or wp-content/plugins/wp-super-cache directories.
5. Remove any wp-cache rewrite rules from /.haccess file
6. Start up Apache.
7. Make sure everything is working.
8. Reinstall wp-super-cache from scratch. Be sure to get the latest version.
That’s it! How simple was that? If you find this solution useful, feel free to leave a comment or link back to this post.