PHP mysql_connect randomly failing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon Drukman

    PHP mysql_connect randomly failing

    I've got a library of PHP code whose first line is a mysql_connect
    statement, like this:

    $dbh=mysql_conn ect() or die("mysql connect failed: $php_errmsg");

    Approximately 1% of the time it just fails, for no stated reason:

    Warning: mysql_connect() [http://www.php.net/function.mysql-connect]:
    in /var/httpd/htdocs/pi/pi.php on line 3
    mysql connect failed:

    Any ideas why this would be happening? PHP is version 4.3.1 (same
    results with the latest 4.3.3 release candidate), Mysql is 4.0.12

    thanks
    -jsd-



    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw

  • Aaron Miles

    #2
    Re: PHP mysql_connect randomly failing

    Hi

    Do you think you might have reached the maximum number of allowed
    connections.

    Try and double or triple this figure and see what happens.

    Thanks

    Aaron Miles

    "Jon Drukman" <jsd@cluttered. com> wrote in message
    news:bhu6iu$ddt $1@FreeBSD.csie .NCTU.edu.tw...[color=blue]
    > I've got a library of PHP code whose first line is a mysql_connect
    > statement, like this:
    >
    > $dbh=mysql_conn ect() or die("mysql connect failed: $php_errmsg");
    >
    > Approximately 1% of the time it just fails, for no stated reason:
    >
    > Warning: mysql_connect() [http://www.php.net/function.mysql-connect]:
    > in /var/httpd/htdocs/pi/pi.php on line 3
    > mysql connect failed:
    >
    > Any ideas why this would be happening? PHP is version 4.3.1 (same
    > results with the latest 4.3.3 release candidate), Mysql is 4.0.12
    >
    > thanks
    > -jsd-
    >
    >
    >
    > --
    > MySQL General Mailing List
    > For list archives: http://lists.mysql.com/mysql
    > To unsubscribe:[/color]
    http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw[color=blue]
    >[/color]


    Comment

    • Aaron Miles

      #3
      Re: PHP mysql_connect randomly failing

      Hi

      Do you think you might have reached the maximum number of allowed
      connections.

      Try and double or triple this figure and see what happens.

      Thanks

      Aaron Miles

      "Jon Drukman" <jsd@cluttered. com> wrote in message
      news:bhu6iu$ddt $1@FreeBSD.csie .NCTU.edu.tw...[color=blue]
      > I've got a library of PHP code whose first line is a mysql_connect
      > statement, like this:
      >
      > $dbh=mysql_conn ect() or die("mysql connect failed: $php_errmsg");
      >
      > Approximately 1% of the time it just fails, for no stated reason:
      >
      > Warning: mysql_connect() [http://www.php.net/function.mysql-connect]:
      > in /var/httpd/htdocs/pi/pi.php on line 3
      > mysql connect failed:
      >
      > Any ideas why this would be happening? PHP is version 4.3.1 (same
      > results with the latest 4.3.3 release candidate), Mysql is 4.0.12
      >
      > thanks
      > -jsd-
      >
      >
      >
      > --
      > MySQL General Mailing List
      > For list archives: http://lists.mysql.com/mysql
      > To unsubscribe:[/color]
      http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw[color=blue]
      >[/color]


      Comment

      Working...