Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. See also freeing resources.
Freeing resources
Due to the reference-counting system introduced with PHP 4's Zend Engine, it is automatically detected when a resource is no longer referred to (just like Java). When this is the case, all resources that were in use for this resource are made free by the garbage collector. For this reason, it is rarely ever necessary to free the memory manually by using some free_result function.
I have several incidents with the error that the mysql connections are over the limit of the server set up.
My questions are:
1) will mysql_close() be helpful? according to the the php manual, that mysql_close() is not heloful in most cases. Unless that after the last mysql query, we still have large number non database php process. That is not in my case, after my last query, I used to display the results. And in many cases, the results are not big. Even the client browser may take time to download the page (with images), the php script itself should end very soon after my last mysql query. So the mysql resources and connections should be already released, right?
2) the current mysql and the current general web server should be very powerful now. The current web server should be able to run dozens huge mysql database backend web sites, right? I am only running about 2 dozens mysql database backend web sites. And only a few of the web sites may have good traffic. Others, just less traffic small sites. And my php pages executing pretty quick. So I should look at hardware update solutions? With today's equipments, if i get a good server, the mysql connection limits shouldn't be a problem for running 30-40 mysql (small to middle size traffic) web sites, right?
3) I am going to increase the limits of the mysql connections on my server? What is the number of the connections vs. the memory of the server?
So it should be a hardware solution actually?
Thanks!