#50263 [NEW]: mysql_connect does not accept localhost
| From: | dominique at ottello dot net | Date: | Sun, 22 Nov 2009 18:13:41 +0000 |
| Subject: | #50263 [NEW]: mysql_connect does not accept localhost | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-144930@lists.php.net to get a copy of this message | ||
From: dominique at ottello dot net
Operating system: Windows XP
PHP version: 5.3.1
PHP Bug Type: MySQL related
Bug description: mysql_connect does not accept localhost
Description:
------------
Hello,
mysql_connect does not works if host is localhost, correct if host is
127.0.0.1
In the exemple below :
$db_host = "localhost"; //Does not work
$db_host = "127.0.0.1"; //Works
No problem with version 5.3.0.
Best regards
Reproduce code:
---------------
function __construct($db_host, $db_username, $db_password, $db_name) {
$this->link_id = mysql_connect($db_host, $db_username, $db_password);
if ($this->link_id) {
if (@mysql_select_db($db_name, $this->link_id)) return
$this->link_id;
else error('Impossible de se connecter à la base de données. MySQL
dit : '.mysql_error(), __FILE__, __LINE__);
}
else error('Impossible de se connecter au serveur MySql. MySQL dit :
'.mysql_error(), __FILE__, __LINE__);
}
Expected result:
----------------
Connecting to data base
--
Edit bug report at http://bugs.php.net/?id=50263&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50263&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50263&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50263&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50263&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50263&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50263&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50263&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50263&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50263&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50263&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50263&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50263&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50263&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50263&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50263&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50263&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50263&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50263&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50263&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50263&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50263&r=mysqlcfg