I've got a fully patched Ubuntu 12.04 Server VM that I'm using to host a few low traffic sites.
My site is PHP (WordPress) and uses mysqli to connect to a MySql database - pretty standard stuff :)
Everything works fine until suddenly connections to the DB start failing. Pressing refresh a couple of times will make the site work again - for a while. It gets worse and worse until all sites are completely unusable. Only restarting Apache brings them back.
When it's occurring: * I've checked that the DB is not overloaded * The DB is able to accept more connections (it's completely idle when the issue is occurring). * Apache is not overloaded - these are very low traffic sites. * The server is not out of memory or running at a high load average. * There are no errors in any of the logs.
Researching the issue a bit I find when the problem is occurring although the 'new mysqli' connect call returns successfully if a do a var_dump on the connection object everything appears to be NULL. (server_info = NULL, client_info => NULL etc)
Also while the problem is occurring I am able to run PHP scripts on the command line and they are able to connect to the DB successfully.
-this problem seems to be within Apache.
My only option at the moment is to have a cron script to restart Apache every 5 minutes - which is really nasty...
Can any one help? Please!!