|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48082 mysql_connect does not work with named pipes
Submitted: 2009-04-26 18:31 UTC Modified: 2010-09-22 17:16 UTC
Avg. Score:4.4 ± 0.7
Reproduced:20 of 20 (100.0%)
Same Version:8 (40.0%)
Same OS:13 (65.0%)
From: andrew dot answer at gmail dot com Assigned: mysql (profile)
Status: Closed Package: MySQL related
PHP Version: 5.3.0RC1 OS: win32 only - Windows XP
Private report: No CVE-ID: None
 [2009-04-26 18:31 UTC] andrew dot answer at gmail dot com


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-26 21:07 UTC]
What if you pass proper parameters? "." as host is quite invalid..
 [2009-04-27 00:04 UTC]
No it's not Jani. :-)

Confirmed. Looks like it's with the VC9 binaries -- is that what you are using (not VC6)? Another difference related to getaddrinfo...

'' (empty string) and 'localhost' work. BTW localhost is actually using TCP/IP, contrary to what the manual says. Also (even in 5.2), the empty string is also changing to localhost -- I'm not sure when the behavior changed (or if it's MySQL server-related), but that used to use a named pipe without needing to specify '.' :-/
 [2009-04-27 16:24 UTC] andrew dot answer at gmail dot com
php is php-5.3.0RC1-Win32-VC6-x86.msi, thread-safe version.

I think what behavior of mysql_connect should be same as in previous php 
version(s). I check different host values for php 5.2.5:
null - FAILED
'localhost' - FAILED
'.' - OK
Please refer to php and mysql documentation and mysqli_ functions.
 [2009-04-27 16:27 UTC] andrew dot answer at gmail dot com
I think it's because you use new mysql library (mysqlnd) in background 
of mysql-related functions, and break the default behavior.
 [2009-06-20 11:36 UTC]
Andrei, fixable? or need help on this one? I'm not sure it is very critical or widely used. it could wait for 5.3.1.
 [2009-06-29 08:42 UTC] uwendel at mysql dot com
Aren't named pipes considerable slower than TCP/IP: why use named pipes ?! I won't work on named pipe support for mysqlnd, if its slower, which is the case AFAIK.
 [2009-06-29 09:40 UTC] andrew dot answer at gmail dot com
regarding performance
 [2009-06-29 09:43 UTC] andrew dot answer at gmail dot com
 [2009-10-20 19:56 UTC] kulakov74 at yandex dot ru
I confirm this with the just installed PHP 5.3.0 on Win XP, I used to use pipes and had skip-networking in my my.ini, I still can connect with mysql.exe, but PHP does not connect this way any more - I had to comment out skip-networking and set the right port in mysql.default_port = 3306 (PHP used to work without it when I used TCP long ago). 
Yes, the dot does not work any more, as if it cannot be resolved to localhost. 
If I have mysql.default_socket = mysql in my php.ini, mysqlnd connects to localhost via UNIX socket, otherwise it uses TCP. 

I agree these things are not critical, yet they have to be mentioned or explained somewhere. 

Got some info on pipes here: (comments)
 [2010-02-02 07:07 UTC] peaceable_whale at hotmail dot com
I have the same problem using PHP 5.3.1 on IIS 7.5 w/FastCGI and MySQL 5.1.43. Is there any update on this issue?
 [2010-02-17 20:11 UTC] quakvorgus at yahoo dot com
Confirming what andrew wrote.
@kulakov74: Thanks for the information. Setting mysql.default_socket = mysql does not solve the issue for me.
Will have to switch to tcp connections instead of using named pipes.
Please, the official documentation should be updated about this change from php 5.2 to 5.3.
 [2010-05-18 20:31 UTC] dex_is_cool at loopmod dot com
I can't get named pipes working. 
It _always_ falls back to TCP, and fails if it can't get TCP connection.

Windows XP sp3
IIS 5.1 

 [2010-08-05 15:37 UTC]
-Type: Bug +Type: Feature/Change Request
 [2010-08-16 16:38 UTC]
-Status: Assigned +Status: Analyzed
 [2010-08-20 12:24 UTC]
A patch is being worked on
 [2010-09-22 17:14 UTC]
Automatic comment from SVN on behalf of andrey
Log: Fix for
Request #48082 mysql_connect does not work with named pipes
 [2010-09-22 17:16 UTC]
-Status: Analyzed +Status: Closed
 [2010-09-22 17:16 UTC]
Support will be in the next minor PHP version, be it 5.4 or something else. 5.3.x won't get this, as this is classified as new feature.
 [2010-09-28 15:50 UTC] peaceable_whale at hotmail dot com
I do not agree that supporting named pipe is a new feature.

Named pipe allows MySQL Server in Windows to operate without TCP/IP and the MySQL Client Library has been supporting it. mysqlnd should have been able to connect MySQL Server via named pipe since its intrduction. The patch just added the missing feature back. Since there is no timeframe for the next minor PHP version, it is quite unfair to ask those relying on named pipe to wait for that.

Please add support to named pipe in 5.3.x.
 [2010-12-02 00:00 UTC] stevenmartin99 at gmail dot com
how many 5.3.x  will there be?

you can be serious carrying this issue on futher?

iv extensivly tested this and 

php5.3.0  works 

php5.3.1 doesnt
php5.3.2 doesnt
php5.3.3 doesnt

please fix in php5.3.4   - this is a huge issue as i see it.
 [2010-12-02 00:07 UTC] stevenmartin99 at gmail dot com
SORRY forgot to mention the test i used.

download  WampServer2.0i with php5.3.0

(using http://localhost) test phpmyadmin  -   works

install addon php5.3.1  -> test phpmyadmin  -  doesnt work (blank page)
install addon php5.3.2  -> test phpmyadmin  -  doesnt work (blank page)
install addon php5.3.3  -> test phpmyadmin  -  doesnt work (blank page)

(mysql version never changed in test)

change the hosts file not to include  ::1 localhost   and then  phpmyadmin works

PS - This is not a solution in my eyes.. cant you just have it working until the  mysql issue is fixed reading the hosts file?

why carry this issue on longer?
 [2011-01-18 02:48 UTC] jose dot nobile at gmail dot com
Why if this bug is open, the documentation is not consistent:
 [2011-02-04 18:52 UTC] peaceable_whale at hotmail dot com
Reported as Documentation Problem at
 [2012-04-24 14:44 UTC] peaceable_whale at hotmail dot com
This issue has not been fixed in PHP 5.4.x. I have opened a bug report at
 [2012-04-24 14:45 UTC] peaceable_whale at hotmail dot com
Oops, posted a wrong link. The correct link is
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC