I am currently getting the two below errors on a LAMP server running Ubuntu 14.04.
Warning: mysqli::mysqli(): (HY000/1040): Too many connections in /var/www/html/classes/Db.class.php on line 17
Fatal error: Database connection failed: Too many connections in /var/www/html/classes/Db.class.php on line 23
A few things worth mentioning.
- I was running a few cron jobs with wget (changed to curl) which created over 1000 files in root(should I delete them?)
- After I restarted the server the errors are still present
- I checked the mysql max_connections:
max_connections | 151
- I'm pretty sure that I closed the connection after each query. This never happened before setting up those crons.
I have a snapshot of the server from yesterday and it would be very easy to set that up and get rid of the errors, but I would like to know where they are coming from.
So what should I do to get rid of these errors?