|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-03-18 17:57 UTC] jad at hungover dot org
Description:
------------
When using mysql_connect with host:port parameter, with port other than 3306, the connection times out.
Am able to telnet to the DB host on the alternative port, with mysql responding as expected.
Tried using latest snapshot, as well as 5.2.5
Reproduce code:
---------------
<?
if( mysql_connect('192.168.151.116:3306','foo','**********') ) {
print "3306 connected OK\n";
} else {
print "3306 failed connect\n";
}
if( mysql_connect('192.168.151.116:3307','foo','**********') ) {
print "3307 connected OK\n";
} else {
print "3307 failed connect\n";
}
?>
Expected result:
----------------
3306 connected OK
3307 connected OK
Actual result:
--------------
[root@dopey default]# /root/newphp/php5.2-200803181530/sapi/cli/php test.php
3306 connected OK
Warning: mysql_connect(): Can't connect to MySQL server on '192.168.151.116' (4) in /var/www/sites/default/htdocs/test.php on line 7
3307 failed connect
[root@dopey default]#
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 17:00:01 2025 UTC |
Works for me: php > var_dump(mysql_connect('192.168.1.102:3308','root','...')); resource(1) of type (mysql link) Which libmysql version are you using and might you create a tcpdump log or similar so we can analyze that? Thanks.