Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 228265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:40:03+00:00 2026-05-11T19:40:03+00:00

Is it crucial to close mysql connections efficiency wise, or does it automatically close

  • 0

Is it crucial to close mysql connections efficiency wise, or does it automatically close after php file has run?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:40:03+00:00Added an answer on May 11, 2026 at 7:40 pm

    From the documentation:

    Note: The link to the server will be closed as soon as the execution of the script ends, unless it’s closed earlier by explicitly calling mysql_close().

    If your script has a fair amount of processing to perform after fetching the result and has retrieved the full result set, you definitely should close the connection. If you don’t, there’s a chance the MySQL server will reach it’s connection limit when the web server is under heavy usage. If you can’t close the MySQL connection until near the end of the script, it’s cleaner though unnecessary to do so explicitly.

    I’m not certain how fastcgi affects things. One page claims that a build of PHP that supports fastcgi will create persistent connections, even for mysql_connect. This contradicts the documentation in that the connection is closed when the process, rather than the script, ends. Rather than testing it, I’m going to recommend using mysql_close(). Actually, I recommend using PDO, if it’s available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently making an iPhone app that has PDF viewing a crucial part of
I'm working on a project where efficiency is crucial. A hash table would be
I need to do something where the file sizes are crucial. This is producing
I am in a crucial project and I am trying to speed up the
Following the Crucial staging setup tutorial , I copied our live setup to a
It is crucial that I transfer the least amount of data possible between server
For this problem speed is pretty crucial. I've drawn a nice image to explain
I've got a page which uses Flash with animations (These are not crucial but
This has been grinding my gears for at least a week now. I have
This is the crucial code: var ajaxCallTimeoutID = null; $(document).ready(function() { $(input[id^='question']).live('keyup',function(ev){ id=this.id.substr(8); if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.