6.0.0-beta1
7/5/25

[#9738] Fatal error using localhost MySQL with port number
Summary Fatal error using localhost MySQL with port number
Queue Horde Base
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester a.p.meiners (at) planet (dot) nl
Created 03/29/2011 (5212 days ago)
Due
Updated 06/30/2011 (5119 days ago)
Assigned 05/21/2011 (5159 days ago)
Resolved 06/30/2011 (5119 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
06/30/2011 08:52:30 AM Jan Schneider State ⇒ Resolved
 
06/30/2011 08:52:24 AM Git Commit Comment #6 Reply to this comment
Changes have been made in Git for this ticket:

[jan] Convert host parameter from "localhost" to "127.0.0.1" in MySQL 
drivers (Request #9738).

  5 files changed, 46 insertions(+), 31 deletions(-)
http://git.horde.org/horde-git/-/commit/05341a899795de7b85ee1ace58ffe4969baa677d
05/21/2011 10:02:30 PM Chuck Hagenbuch Comment #5
State ⇒ Assigned
Reply to this comment
Sounds okay to me.
05/18/2011 04:23:34 PM Jan Schneider Comment #4
Version ⇒ Git master
Reply to this comment
I tend to convert "localhost" to "127.0.0.1" automatically, because 
this is probably what most users intended, and the magic behavior of 
MySQL to use sockets if the host is "localhost" already caused many 
WTF moments for administrators.
OTOH many admins and developers might already be aware of this 
behavior and could be using "localhost" intentionally.
Anybody having an opinion on this?
03/29/2011 12:57:52 PM Jan Schneider Comment #3
State ⇒ Feedback
Assigned to Jan Schneider
Reply to this comment
For now, I've removed the exception.

I tend to convert "localhost" to "127.0.0.1" automatically, because 
this is probably what most users intended, and the magic behavior of 
MySQL to use sockets if the host is "localhost" already caused many 
WTF moments for administrators.
OTOH many admins and developers might already be aware of this 
behavior and could be using "localhost" intentionally.
03/29/2011 12:54:36 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git for this ticket:

Don't throw exception when setting port number while using localhost 
in PDO MySQL driver (Bug #9738)

  3 files changed, 3 insertions(+), 5 deletions(-)
http://git.horde.org/horde-git/-/commit/064351164191941ac0fc781b74bd752802448e90
03/29/2011 08:29:56 AM a (dot) p (dot) meiners (at) planet (dot) nl Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Fatal error using localhost MySQL with port number
Queue ⇒ Horde Base
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
Localhost with portnumber fatal error:
During configuration you can enter 'localhost' as TCP MySQL host. If 
however you do not delete the port number this results in a fatal 
error and Horde4 will not start. If you have deleted the port number, 
saved the config, move to a different tab and change paramaters on 
that tab and again save the config, the default port number is again 
entered in the MySQL host tab and thus again results in a fatal error.

Workaround:
There is a simple workaround which if included in the installation 
documentation can avoid the issue. If instead of 'localhost' you enter 
the IP address 127.0.0.1 as the TCP host, you can leave the port 
number unchanged and all works fine.

Solution:
A more elegant solution would possibly be adding one line of code 
which behind the scenes changes or equates 'localhost' with the IP 
address 127.0.0.1 or simply neglects the port value in case of 
'localhost' or '127.0.0.1' entry.

Saved Queries