BentCoder
BentCoder

Reputation: 12740

Mysql database close or not

I'll develop a website where there might be thousands of users using it concurrently with database features. In recent years I never closed my database connections in my apps. In this case, is it better to close database connection after running every query or shall just leave it open?

I know that exhausting the connection pool etc. happens if not closed but I tried to look for answers for particularly MySql but I was not very lucky.

I'm using Codeigniter 2.1, MySql with PHP.

Thanks

Upvotes: 0

Views: 82

Answers (1)

Nikola K.
Nikola K.

Reputation: 7155

You don't have to close a connection manually. PHP will automatically close it for you at the end of the script's execution.

Upvotes: 4

Related Questions