| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2009-11-22 18:17 UTC] felipe@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 13:00:02 2025 UTC | 
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