From:
Operating system: Windows 7
PHP version: 5.3.3
Package: MySQL related
Bug Type: Bug
Bug description:host name of localhost doesn't work any more
Description:
------------
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
127.0.0.1 - 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 = '127.0.0.1';
PS: I know I've written php but the C code is equally short.
Test script:
---------------
mysql_connect('localhost', 'root', 'secret');
mysql_connect('127.0.0.1', 'root', 'secret');
Expected result:
----------------
To be able to specify the mysql server name as 'localhost'
--
Edit bug report at http://bugs.php.net/bug.php?id=52516&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52516&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52516&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52516&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52516&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52516&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52516&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52516&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52516&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52516&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52516&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52516&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52516&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52516&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52516&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52516&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52516&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52516&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52516&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52516&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52516&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52516&r=mysqlcfg