RE: [PHP] PHP On Solaris 9 - MySQL Problem

From: Date: Thu, 18 Mar 2004 03:02:51 +0000
Subject: RE: [PHP] PHP On Solaris 9 - MySQL Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-180778@lists.php.net to get a copy of this message
You might try an fsockopen() to port 3306 on the dbserver and see if it works. If not, you get a reasonably descriptive error. I just tried a couple of known servers and bogus addresses with this code: <?php $ipaddr = "localhost"; # substitute the IP address here $fp = fsockopen($ipaddr, 3306, $errno, $errstr, 5.0); var_dump($fp, $errno, $errstr); if ($fp) fclose($fp); ?> A server listening on that port produces: resource(4) of type (stream) string(0) "" NULL One that is not produces: Warning: fsockopen() [http://www.php.net/function.fsockopen]: unable to connect to 192.168.1.1:3306 in d:\TEST2.PHP on line 2 bool(false) int(10060) string(185) "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond." I get the same response whether I try it from CLI or within Apache. I did the test on Windows but the same would work and might tell you something useful if run from the server. -- Tom

« previous php.general (#180778) next »