Re: PHP mysql_connect randomly failing

2003-08-22 Thread Rajesh Kumar
Jon Drukman unknowingly asked us:
Antony Dovgal wrote:

try to use error_reporting(E_ALL); and to see what happends.
maybe error logging will help you to solve your trouble.
I don't beleive in such bugs, it's a problem of your code imho.


here's my code:

mysql_connect() or die("mysql connect failed: $php_errmsg / " . 
mysql_error());

that one line in a script all by itself will fail randomly with no error 
message.  still think it's my problem?

anyway i changed it to mysql_connect('localhost', 'username') and that 
seems to have straightened it out.  i need to wait a few more days to 
see if it pops up again but over the last 24 hrs it has been ok.
I feel, that it does not always assume localhost. I assume that you're 
using Apache.

There's no point $php_errmsg. I think you're being connected as 
[EMAIL PROTECTED]

Try finding how you're connected using the MySql CURRENT_USER() function.

Also:



error_reporting (E_All ^ E_NOTICE);
$con = mysqk_connect ("localhost","uname","") or die(mysql_error());
?>

Try supplying all three arguments to mysl_connect().

--
[ Rajesh Kumar ]
__
Meet the guy at http://www.meetRajesh.com/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: PHP mysql_connect randomly failing

2003-08-22 Thread Jon Drukman
Antony Dovgal wrote:
try to use error_reporting(E_ALL); and to see what happends.
maybe error logging will help you to solve your trouble.
I don't beleive in such bugs, it's a problem of your code imho.
here's my code:

mysql_connect() or die("mysql connect failed: $php_errmsg / " . 
mysql_error());

that one line in a script all by itself will fail randomly with no error 
message.  still think it's my problem?

anyway i changed it to mysql_connect('localhost', 'username') and that 
seems to have straightened it out.  i need to wait a few more days to 
see if it pops up again but over the last 24 hrs it has been ok.

-jsd-



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: PHP mysql_connect randomly failing

2003-08-21 Thread Antony Dovgal
On Thu, 21 Aug 2003 18:18:37 -0700
Jon Drukman <[EMAIL PROTECTED]> wrote:

> that is true, but in this case, neither $php_errmsg nor mysql_error() 
> return anything.  i print them both out when the connect fails and they 
> are both just blank.

try to use error_reporting(E_ALL); and to see what happends.
maybe error logging will help you to solve your trouble.
I don't beleive in such bugs, it's a problem of your code imho.

---
WBR,
Antony Dovgal aka tony2001
[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: PHP mysql_connect randomly failing

2003-08-21 Thread Daniel Rossi
funny i was just having the same problemo with mysql 3.22 on php3 the most painful 
system to debug i hate it to bits, anyway mysql_error doesnt get returned on 
permission or database connection errors, i wonder if that is soughted out in mysql4 
?? maybe this is a php.net question

>>> Jon Drukman <[EMAIL PROTECTED]> 08/22/03 11:18am >>>
Antony Dovgal wrote:
>>mysql_error is not set when mysql_connect fails, because there is no 
>>actual mysql resource to get the error message from.
> 
> yes, there is no mysql resource at this moment.
> just don't specify it and mysql_error() will tell something like "Can't connect to 
> local MySQL server through socket '/tmp/mysql.sock' (111)".

that is true, but in this case, neither $php_errmsg nor mysql_error() 
return anything.  i print them both out when the connect fails and they 
are both just blank.

-jsd-




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql 
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] 



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: PHP mysql_connect randomly failing

2003-08-21 Thread Jon Drukman
Antony Dovgal wrote:
mysql_error is not set when mysql_connect fails, because there is no 
actual mysql resource to get the error message from.
yes, there is no mysql resource at this moment.
just don't specify it and mysql_error() will tell something like "Can't connect to local 
MySQL server through socket '/tmp/mysql.sock' (111)".
that is true, but in this case, neither $php_errmsg nor mysql_error() 
return anything.  i print them both out when the connect fails and they 
are both just blank.

-jsd-



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: PHP mysql_connect randomly failing

2003-08-21 Thread QWERTY






If you reach to maximum mysql connection limit or link limit, mysql_connect will fail.
Check limits and current fullness. 
---Original Message---
 

From: Jon Drukman
Date: 21 Ağustos 2003 Perşembe 11:32:47
To: [EMAIL PROTECTED]
Subject: Re: PHP mysql_connect randomly failing
 Antony Dovgal wrote:> On Tue, 19 Aug 2003 14:36:15 -0700> Jon Drukman <[EMAIL PROTECTED]> wrote:>>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> > You should turn > track_errors = On> in your php.ini (default value is Off), if you want to see last PHP error in $php_errmsg variable.> > But I suppose the best solution would be not to use $php_errmsg, but to use mysql_error() - > at least this function does not depend on configuration settings.mysql_error is not set when mysql_connect fails, because there is no actual mysql resource to get the error message from.anyway i set track_errors=on (confirmed with phpinfo()) but i still get the same message as above - no error is reported.-jsd--- MySQL General Mailing ListFor list archives: http://lists.mysql.com/mysqlTo unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]. 







  IncrediMail - Email has finally evolved - Click Here

Re: PHP mysql_connect randomly failing

2003-08-21 Thread Antony Dovgal
On Wed, 20 Aug 2003 21:31:48 -0700
Jon Drukman <[EMAIL PROTECTED]> wrote:

> mysql_error is not set when mysql_connect fails, because there is no 
> actual mysql resource to get the error message from.
yes, there is no mysql resource at this moment.
just don't specify it and mysql_error() will tell something like "Can't connect to 
local MySQL server through socket '/tmp/mysql.sock' (111)".

---
WBR,
Antony Dovgal aka tony2001
[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: PHP mysql_connect randomly failing

2003-08-21 Thread Jon Drukman
Antony Dovgal wrote:

On Tue, 19 Aug 2003 14:36:15 -0700
Jon Drukman <[EMAIL PROTECTED]> wrote:

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
You should turn 
track_errors = On
in your php.ini (default value is Off), if you want to see last PHP error in $php_errmsg variable.

But I suppose the best solution would be not to use $php_errmsg, but to use mysql_error() - 
at least this function does not depend on configuration settings.
mysql_error is not set when mysql_connect fails, because there is no 
actual mysql resource to get the error message from.

anyway i set track_errors=on (confirmed with phpinfo()) but i still get 
the same message as above - no error is reported.

-jsd-



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: PHP mysql_connect randomly failing

2003-08-20 Thread Antony Dovgal
On Tue, 19 Aug 2003 14:36:15 -0700
Jon Drukman <[EMAIL PROTECTED]> wrote:

> I've got a library of PHP code whose first line is a mysql_connect 
> statement, like this:
> 
> $dbh=mysql_connect() 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
You should turn 
track_errors = On
in your php.ini (default value is Off), if you want to see last PHP error in 
$php_errmsg variable.

But I suppose the best solution would be not to use $php_errmsg, but to use 
mysql_error() - 
at least this function does not depend on configuration settings.


---
WBR,
Antony Dovgal aka tony2001
[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: PHP mysql_connect randomly failing

2003-08-19 Thread Jon Drukman
unix domain.

Michael S. Fischer wrote:
Are you connecting through a TCP or a UNIX domain socket?

--Michael


-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Jon Drukman
Sent: Tuesday, August 19, 2003 2:36 PM
To: [EMAIL PROTECTED]
Subject: 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_connect() 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:


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: PHP mysql_connect randomly failing

2003-08-19 Thread Michael S. Fischer
Are you connecting through a TCP or a UNIX domain socket?

--Michael

> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Jon Drukman
> Sent: Tuesday, August 19, 2003 2:36 PM
> To: [EMAIL PROTECTED]
> Subject: 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_connect() 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?> [EMAIL PROTECTED]
> 
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]