The system was fine in tests and developments. And the sites on the server running fine for months without problems and suddenly this error pops up. But the live server has been added a few sites. So the only changes are the adding new sites to the server. But these sites traffic was small specially in the evening hours.
All sites on the server developed by me. And we use basically the same programming logics. And the server was running fine until recently the hosting company was moving their office to a new location, but the server should still be in the old places. Still some networks set ups changes may be taken.
It is mysql/apache/freebsd. The hosting company upgrade our mysql, increase the open files limits, so far it was fine. But it is just one day now.
Last time, I had a BIND memory leak problems, I had run the server for months without that problem, but suddenly it popped up. No set up in the system was changed. I don't know why not before but now. I updated the BIND and the memory leak problem was gone.
At the same time, what will be a php prgrammer has to keep his eye open to do better programming to reduce the error of "too many open files"? I uses mysql_connect, and I use "divide and conquer" approach whenever I can, break the large php page to small pages if I can.