ID: 50263 Updated by: fel...@php.net Reported By: dominique at ottello dot net -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Windows XP PHP Version: 5.3.1 New Comment:
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. See bug #50172 Previous Comments: ------------------------------------------------------------------------ [2009-11-22 18:13:40] dominique at ottello dot net 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 this bug report at http://bugs.php.net/?id=50263&edit=1