I'm writing a program that parses a *lot* of log files into a database. It's completely O-O, and each object opens a database connection to mysql using mysqli->connect().

Here's my problem - the program works great for a limited number of log files, but if I run it over a large number of files, as it gets farther along in processing, I get warnings as shown below.. (although NOT for every query).

"Can't connect to MySQL server on 'localhost' (10048) in..."

However, mysqli is not returning any errors. The connect() function seems to work OK, and "mysqli->error" is empty.

My working assumption is that somehow I have too many connections open at once, although the code is pretty good about closing them when it's done with them (the destructors in the objects all invoke mysqli->close() as the last thing they do.

I'm running:
Apache/2.0.47 (Win32) PHP/5.0.3 (Win XP)
MySQL 4.1
with no limit set on persistent links or number of connections.

Any help would be appreciated.


Slight correction ... I'm creating a new mysqli connection in each object using

$db = new mysqli(....);

(not mysqli->connect() )


Just a quick sanity check: Is MySQL running?

Just a quick sanity check: Is MySQL running?

Yes. This job runs several thousand queries, only a handful fail like this. Everything else works fine. That's why I'm puzzled.

Sometimes I just wind up fixing vexing problems like this by copying the code that's the same from another working file...