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

  • Home
  • SEARCH
  • 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 343349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:53:21+00:00 2026-05-12T10:53:21+00:00

I’m a PHP newbie working a some scripts to display some news articles from

  • 0

I’m a PHP newbie working a some scripts to display some news articles from a databse and wanted to find out a couple of things.

  • For opening a connection to a MySQL database, which is a better option mysql_connect or mysql_pconnect?
  • What are the advantages or drawbacks of using a persistent connection to the database?
  • And in what kind of scenario will a persistent connection be called for?
  • 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-12T10:53:21+00:00Added an answer on May 12, 2026 at 10:53 am

    If you are going to write a web page there is no need of persistent connection. It takes too much resources. Use mysql_connect. Minimize the time your db connection is open and not used as much as you can. Open, fetch what you want, close. It doesn’t need to stay open while the users are just reading. The connection will be used eventually if they respond – INSERT/go to another page..

    Here are some good points about NOT USING persistent connection in web applications

    • When you lock a table, normally it is unlocked when the connection closes, but since persistent connections do not close, any tables you
      accidentally leave locked will remain locked, and the only way to
      unlock them is to wait for the connection to timeout or kill the
      process. The same locking problem occurs with transactions. (See
      comments below on 23-Apr-2002 & 12-Jul-2003)

    • Normally temporary tables are dropped when the connection closes, but since persistent connections do not close, temporary tables aren’t
      so temporary. If you do not explicitly drop temporary tables when you
      are done, that table will already exist for a new client reusing the
      same connection. The same problem occurs with setting session
      variables. (See comments below on 19-Nov-2004 & 07-Aug-2006)

    • If PHP and MySQL are on the same server or local network, the connection time may be negligible, in which case there is no advantage
      to persistent connections.

    • Apache does not work well with persistent connections. When it receives a request from a new client, instead of using one of the
      available children which already has a persistent connection open, it
      tends to spawn a new child, which must then open a new database
      connection. This causes excess processes which are just sleeping,
      wasting resources, and causing errors when you reach your maximum
      connections, plus it defeats any benefit of persistent connections.
      (See comments below on 03-Feb-2004, and the footnote at
      http://devzone.zend.com/node/view/id/686#fn1)

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

Sidebar

Ask A Question

Stats

  • Questions 205k
  • Answers 205k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Register a URL Handler, then have a link on your… May 12, 2026 at 9:03 pm
  • Editorial Team
    Editorial Team added an answer Google uses a spherical mercator projection based on WGS84. There's… May 12, 2026 at 9:03 pm
  • Editorial Team
    Editorial Team added an answer You should be able to pass a new options object… May 12, 2026 at 9:02 pm

Related Questions

In order to apply a triggered animation to all ToolTip s in my app,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.