Results 1 to 8 of 8

Thread: mysql_pconnect disabled

  1. #1
    Join Date
    Nov 2006
    Posts
    61

    Default mysql_pconnect disabled

    Hi All

    My site went down for a few hours last night. My hosts are excellent with their support and told me that the reason was that they have disabled mysql_pconnect on the server.

    From now on I need to use mysql_connect.

    I will be updating to the latest version of OR within the next couple of weeks. Will this solve the issue or is there anything else I need to do.

    thanks all

    Clive

  2. #2
    Join Date
    Jul 2003
    Location
    California
    Age
    36
    Posts
    4,229

    Default Re: mysql_pconnect disabled

    There is no issue to resolve. Persistent connections are more efficient and reduce latency as it doesn't require a new connection to be opened every time you do something with the database and thus why we use them instead of regular connections.

    Reference:

    http://www.php.net/manual/en/feature...onnections.php
    Open-Realty 2 Documentation

    ~The Difference Between an ORDEAL and an ADVENTURE is ATTITUDE~

  3. #3
    Join Date
    Nov 2006
    Posts
    61

    Default Re: mysql_pconnect disabled

    Hi Mick, thanks for your answer..

    I read the link through a few times and still have trouble understanding a lot of it...

    I realise it's not an issue or bug in the real sense but this has happened twice in the last few months with my sites..

    Both times I got onto the hosts technical support live chat and my sites were back on-line within minutes and when I ask what happened they say in the future I must use mysql_connect because mysql_pconnect is disabled on the server...

    So is this something that my hosts need to know should not and does not need disabling? I really can't fault their service and would not want to move to a new company.

    An important summary. Persistent connections were designed to have one-to-one mapping to regular connections. That means that you should always be able to replace persistent connections with non-persistent connections, and it won't change the way your script behaves. It may (and probably will) change the efficiency of the script, but not its behavior!
    If my hosts won't enable persistent connections is the above possible?

    Thanks

    Clive

  4. #4
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    42
    Posts
    9,796

    Default Re: mysql_pconnect disabled

    It is possible but it could affect the performance of your site. If your host is not willing to enable persistent connections then you should consider moving to a host that will. There is no reason that I can think of for a host to disable persistent connections.

    In include/common.php change $conn->pconnect($db_server,$db_user,$db_password,$db_dat abase) to $conn->connect($db_server,$db_user,$db_password,$db_data base)

    You will have to make this change every time you update OR.

  5. #5
    the_sandking's Avatar
    the_sandking is offline hadron remnant - Moderation Fachmann the_sandking is on a distinguished road
    Join Date
    Apr 2003
    Location
    Nullspace
    Posts
    5,289

    Default Re: mysql_pconnect disabled

    Quote Originally Posted by natural View Post

    Both times I got onto the hosts technical support live chat and my sites were back on-line within minutes and when I ask what happened they say in the future I must use mysql_connect because mysql_pconnect is disabled on the server...

    So is this something that my hosts need to know should not and does not need disabling? I really can't fault their service and would not want to move to a new company.
    This is a sure fire indication your beloved host is oversharing their servers, otherwise, there is no reason to disable persistent connections. If you are fine with paying a host that overshares their servers, then by all means stay where you are.
    "Much of what looks like rudeness in hacker circles is not intended to give offense. Rather, it's the product of the direct, cut-through-the-BS communications style that is natural to people who are more concerned about solving problems than making others feel warm and fuzzy."

    "We gotta' go to the crappy town where I'm a hero!"
    -Hoban 'Wash' Washburne 2485-2519


    "When you’re born you get a ticket to the freak show. When you’re born in America, you get a front-row seat.."
    -George Carlin 1937-2008

    New to Open-Realty® and need help? Check the:
    -OR DOCUMENTATION -

    Important: Read this at least once in your lifetime
    How To Ask Questions The Smart Way

  6. #6
    Join Date
    Nov 2006
    Posts
    61

    Default Re: mysql_pconnect disabled

    Hi all,

    Thank you very much for the explanations...

    I will speak to my hosts and see if I can get them to comply before I make a move to new server and host.

    Clive

  7. #7
    Join Date
    Nov 2006
    Posts
    61

    Default Re: mysql_pconnect disabled

    Hi all,

    Below is the reply from my hosts about pconnect. Having just moved up to a PHP5 server in order to try to keep up with current changes I now find myself having to downgrade to PHP4 or move to a new host...

    Before I make this step I would value anyone's opinion on the reply below.

    Hello ,

    The mysql_pconnect is defined as persistent connection to the database which affects the server performance.

    mysql_pconnect() acts very much like mysql_connect() with two major differences.

    First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.

    Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).

    All this leads to slow down the server performance since it uses high mysql resources.We do have one of our server where all those who want mysql_pconnect are hosted but this server has PHP 4 version.
    Does it really slow the server down so much?

    Thanks all

    Clive

  8. #8
    Join Date
    Jul 2003
    Location
    California
    Age
    36
    Posts
    4,229

    Default Re: mysql_pconnect disabled

    Basically see Sandking's reply as it still applies:

    This is a sure fire indication your beloved host is oversharing their servers, otherwise, there is no reason to disable persistent connections. If you are fine with paying a host that overshares their servers, then by all means stay where you are.
    Persistent connections speed up your application. Anybody looking to run a quality, mission critical website should plan on being with decent enough of a host to allow their site to run as fast and reliably as possible.
    Open-Realty 2 Documentation

    ~The Difference Between an ORDEAL and an ADVENTURE is ATTITUDE~

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts