ID: 35292 User updated by: dgrimes at scvl dot com Reported By: dgrimes at scvl dot com -Status: Feedback +Status: Open Bug Type: MySQL related Operating System: SCO OpenServer PHP Version: 4.4.1 New Comment:
Yes. The path to the socket is correct. The only thing I do to make it work is refresh the page two or three times and it will eventually connect. Another thing, if I use PHP 4.2.3 or less, I don't have the problem at all. I noticed that beginning in PHP 4.3.0 many changes were made in the area of sockets. What is the large negative number that is returned in the message (-2146870980)? What I've seen in the past when the path is incorrect is this: 2002 - Can't connect to local MySQL server through socket '/d/mysql/var/mysqlx.sock' (2) Notice that (2) is a positive integer and not negative. All I did was change mysql.sock to mysqlx.sock in the php.ini file. What's also interesting is that I received the other error (-2146870980) two times before getting the correct error (2). MySQL isn't logging anything so as far as it's concerned, nothing has made an attempt to connect. I thought it might be a timeout so I tried setting some of the timeout values but it didn't help. Is it possible that PHP isn't waiting long enough for MySQL to respond? Is the error saying that it can't find the socket file or that it simply can't connect to the socket file? If you'd like, I can place some debug code in the connect function to see what is happening or I can compile with debug to watch it execute but I'll need instructions on where to place break points and what symbols to look at. Dean Previous Comments: ------------------------------------------------------------------------ [2005-11-20 08:52:09] [EMAIL PROTECTED] Are you sure that path to the socket is correct? ------------------------------------------------------------------------ [2005-11-19 14:58:53] dgrimes at scvl dot com Still have the same problem with the latest snapshot. Dean ------------------------------------------------------------------------ [2005-11-19 14:25:17] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2005-11-19 14:18:21] dgrimes at scvl dot com Description: ------------ I am having random failure on making a connection to MySQL. This the code used to make the connection and has been for several years. if (!$this->linkid = mysql_connect($this->host,$this->user,$this->pass)) DBError(mysql_errno(),mysql_error(),"LINKID-$db",$this->mailerr,$this->sendto); The following error is returned randomly however it happens usually right after starting apache or after a period of inactivity: 2002 - Can't connect to local MySQL server through socket '/d/mysql/var/mysql.so ck' (-2146870980) Starting with version PHP 4.3.0 is when the problem started. Version 4.2.x does not have this problem. I compiled every version until I found where the problem started. I am currently trying to move from 4.0.6 to 4.4.1 but need to get this issue addressed. My system: SCO OpenServer 5.0.4 and 5.0.6 MySQL 4.1.15 Apache 1.3.34 Reproduce code: --------------- if (!$this->linkid = mysql_connect($this->host,$this->user,$this->pass)) DBError(mysql_errno(),mysql_error(),"$this->linkid LINKID-$db",$this->m ailerr,$this->sendto); Expected result: ---------------- I expected to get a resource ID returned. Actual result: -------------- 2002 - Can't connect to local MySQL server through socket '/d/mysql/var/mysql.so ck' (-2146870980) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35292&edit=1
