PHP Classes

Connection Problem - freezing

Recommend this page to a friend!

      My Active Record  >  All threads  >  Connection Problem - freezing  >  (Un) Subscribe thread alerts  
Subject:Connection Problem - freezing
Summary:Freezing aftet couple hours of using
Date:2007-05-31 18:55:54
Update:2007-06-03 18:48:55

  1. Connection Problem - freezing   Reply   Report abuse  
frederico - 2007-05-31 18:55:54
Hello everyone,

Im from Brazil and i using your php class MyActiveRecord on my website.

My question is what can be happening with the mysql connection... because after a a couple hours of to many requests on site to mysql... the site freezes and and i get back the ERROR "could not connect to database server" .

I dont know why what could be happening...

The code that return error is the connection :
// connect to database server
$rscMySQL = @mysql_pconnect($params['host'], $params['user'], $params['pass'])

Its was on my own pc, localhost...

Now, im affraid to get the website into prodution server...

Can anybody help me with this ?
What info do you need from me to help me solve it ?

Thanks to all


  2. Re: Connection Problem - freezing   Reply   Report abuse  
MM Developer - 2007-06-03 18:48:55 - In reply to message 1 from frederico
the mysql persistent connection can cause problems on some platforms. I personally recommend to use mysql_connect and mysql_close at the beginning and end of script executions.

It sounds like your SQL server (after those few hours) just has more persistent connections open on it than it can handle and your database freezes. Try changing it from mysql_pconnect to mysql_connect and at the end of your parent file, do a mysql_close( $link_identifier ) [where $link_identifier is the resource variable for the mysql connection, in your example, it's $rscMySQL]