Something I have always wondered, it seems that virtually no PHP applications ever explicitly close MySQL connections mysqli_close().
How does this work? Does PHP automagically close MySQL connections when scripts stop executing?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, the connection will be closed unless it is a persistent connection (opened with a
p:before the host). Non-persistent resources are freed automatically at the end of the script, because there are no more references to them.From the PHP manual: