Hi there,

I have a general question about Midgard/mySQL/PHP.

Here is my problem :

  I am currently creating a Midgard site which also uses its own mySQL database
but :

  I noticed when using the "SHOW processes" mySQL command that I constantly have
about 20 sleeping processes which can take up to about 60M of RAM and therefore
cause a huge slowndown on the server (which has 64M of RAM).

  I had decided to use persistent links (opened with the PHP pconnect()
function) in order to speed things up but although my mySQL installation seems
to support persistent links (it says so on the phpinfo() page) I have noticed
strange things : I have put in an inherited code-global page-element located on
the root page (so that all the pages from the site have direct access to it) the
following functions :

function mysql_open() {
  global $global_link;
  $global_link = mysql_pconnect("mogao","root") or die(mysql_error());
  echo "Global link : $global_link<BR>";
  if ($global_link)
    $db_select = mysql_select_db("R2", $global_link) or die(mysql_error());
  }

function mysql_simple_query($query) {
  global $global_link;
  mysql_open("R2");
  $result = mysql_query($query, $global_link) or die(mysql_error());
  return $result;
}

However, I keep getting different values for $global_link which means that mysql
opens a persistent link each time the mysql_open() function is executed.

Could anyone please help me solve that problem ?

Thanks a lot !!!

PS : I'm using Midgard 1.4b3 but I don't think this has anything to do with
Midgard.

I also read on a PHP mailing list that someone had a similar problem and one of
the solutions seemed to decrease the "max timeout" mySQL variable so that
sleeping processes get killed after a few minutes instead of the standard 8
hours !

If this is due to PHP3, do you know if it will work with PHP4 ?


--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to