mysql_pconnect issues
I have a problem with mysql db connection.. My application does a lot of queries to the database. And loads results of the query in the page. Before, I used mysql_connect for the connection. I separated it in a different file the connection and then just include the file in my subsequent php files.
So it seems like, i open the dbase and query everytime. The problem came when the server's max connection per hour to the db was set to like 50. then just a couple of tries in my page, it reached the max connection per hour. It turned out I have not been closing my connections.
So i tried closing the connections every time my php scripts end. I am using AJAX (async calls) to php. The problem was still the same, just a couple of views and then it reaches the max.
So i tried using the mysql_pconnect(). In my wamp, i set the max connections to 2. It kinda worked well, but when transferred to server, in linux, the connection was set to 2 also, it again had the ma开发者_JAVA技巧x connection problem.
Apache is used as the webserver. Its really frustrating. Can somebody give light on this?
Thanks a lot :)
精彩评论