|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52516 host name of localhost doesn't work any more
Submitted: 2010-08-02 15:32 UTC Modified: 2010-08-02 15:48 UTC
From: dev at focus-computing dot com dot au Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.3.3 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
37 - 25 = ?
Subscribe to this entry?

 [2010-08-02 15:32 UTC] dev at focus-computing dot com dot au
When asked to specify a server in a TCP/IP environment the name 'localhost' has always worked - it works with lots of other packages.  However it is clearly not working with the latest mysqlnd driver.  We have to specify - which to me has always been synonymous with 'localhost'.

Can we please have the option of specifying 'localhost' back?

I understand there are technical reasons for using the IP address, but this is really hard to explain to our bosses: why the upgrade failed, why the system was down for 3 days, and specifically why this setting was changed to begin with - they just don't understand - I barely understand.

Two lines of code should do it:
if ($servername == 'localhost')
  $servername = '';

PS: I know I've written php but the C code is equally short.

Test script:
mysql_connect('localhost', 'root', 'secret');
mysql_connect('', 'root', 'secret');

Expected result:
To be able to specify the mysql server name as 'localhost'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-02 15:48 UTC]
-Status: Open +Status: Bogus
 [2010-08-02 15:48 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Please see this blog post:
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Apr 18 15:01:24 2021 UTC