Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-11-15 Thread slava at shabrov dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID: 45150
 Comment by: slava at shabrov dot com
 Reported by:conor dot kerr_php at dev dot ceon dot net
 Summary:MySQL functions cannot be used with 5.3.x on Vista
 when using "localhost"
 Status: Bogus
 Type:   Bug
 Package:MySQL related
 Operating System:   Windows Vista
 PHP Version:5.3CVS-2008-07-23 (snap)
 Block user comment: N
 Private report: N

 New Comment:

Just upgraded PHP to v 5.3.3 and got this problem. This thread helped.

In addition to adding to the 'host' file

127.0.0.1   localhost 

you need to comment out 

#::1 localhost 



Fixed this issue to me. I would blame here MySQL not supporting IPv6.



Windows 7 x64; PHP 5.3.3 FastCGI; MySQL 5.1.38


Previous Comments:

[2010-10-19 01:39:24] iswald at yahoo dot com

Same problem, 127.0.0.1 works, but localhost times out in MySQL, though
not SQL Server. Went to add 



127.0.0.1 localhost



to the hosts file, however, it was already there. Not Fixed. Needs
better documentation at least, even if it is a MS problem.



(PHP 5.3.3.0, MySQL 5.1.51, Windows Vista SP 2, no Apache)


[2010-09-11 16:32:18] zarlean at yahoo dot com

I got this to work in Windows 7 (Apache 2.2, PHP 5.3.3, MySQL 5.1.44) 

by adding the line



127.0.0.1 localhost



to the hosts file in C:/Windows/System32/drivers/etc/


[2010-09-06 11:18:20] u...@php.net

Bogus AKA duplicate http://bugs.php.net/bug.php?id=48082


[2010-09-06 08:51:40] songchongzhan at gmail dot com

Did you disable networking on windows. I use MySQL Query Browser connect
to MySQL, 

it has MySQL Error Number 2003. Use mysqli connect to MySQL, it return
like what 

you post:[2002].

And I use named pipe connect to MySQL by MySQL Query Browser, it is OK,
by php 

5.3.x does not support it util now.

Try to open MySQL network connection.


[2010-07-06 19:10:38] and...@php.net

PLEASE READ THIS : 



http://blogs.iis.net/donraman/archive/2010/06/11/php-5-3-and-mysql-connectivity-problem.aspx




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-10-18 Thread iswald at yahoo dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID: 45150
 Comment by: iswald at yahoo dot com
 Reported by:conor dot kerr_php at dev dot ceon dot net
 Summary:MySQL functions cannot be used with 5.3.x on Vista
 when using "localhost"
 Status: Bogus
 Type:   Bug
 Package:MySQL related
 Operating System:   Windows Vista
 PHP Version:5.3CVS-2008-07-23 (snap)
 Block user comment: N

 New Comment:

Same problem, 127.0.0.1 works, but localhost times out in MySQL, though
not SQL Server. Went to add 



127.0.0.1 localhost



to the hosts file, however, it was already there. Not Fixed. Needs
better documentation at least, even if it is a MS problem.



(PHP 5.3.3.0, MySQL 5.1.51, Windows Vista SP 2, no Apache)


Previous Comments:

[2010-09-11 16:32:18] zarlean at yahoo dot com

I got this to work in Windows 7 (Apache 2.2, PHP 5.3.3, MySQL 5.1.44) 

by adding the line



127.0.0.1 localhost



to the hosts file in C:/Windows/System32/drivers/etc/


[2010-09-06 11:18:20] u...@php.net

Bogus AKA duplicate http://bugs.php.net/bug.php?id=48082


[2010-09-06 08:51:40] songchongzhan at gmail dot com

Did you disable networking on windows. I use MySQL Query Browser connect
to MySQL, 

it has MySQL Error Number 2003. Use mysqli connect to MySQL, it return
like what 

you post:[2002].

And I use named pipe connect to MySQL by MySQL Query Browser, it is OK,
by php 

5.3.x does not support it util now.

Try to open MySQL network connection.


[2010-07-06 19:10:38] and...@php.net

PLEASE READ THIS : 



http://blogs.iis.net/donraman/archive/2010/06/11/php-5-3-and-mysql-connectivity-problem.aspx


[2010-05-11 08:30:30] kiewic at gmail dot com

Same problem with Windows Vista Ultimate SP2. Why isn't this a bug?




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-09-11 Thread zarlean at yahoo dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID: 45150
 Comment by: zarlean at yahoo dot com
 Reported by:conor dot kerr_php at dev dot ceon dot net
 Summary:MySQL functions cannot be used with 5.3.x on Vista
 when using "localhost"
 Status: Bogus
 Type:   Bug
 Package:MySQL related
 Operating System:   Windows Vista
 PHP Version:5.3CVS-2008-07-23 (snap)
 Block user comment: N

 New Comment:

I got this to work in Windows 7 (Apache 2.2, PHP 5.3.3, MySQL 5.1.44) 

by adding the line



127.0.0.1 localhost



to the hosts file in C:/Windows/System32/drivers/etc/


Previous Comments:

[2010-09-06 11:18:20] u...@php.net

Bogus AKA duplicate http://bugs.php.net/bug.php?id=48082


[2010-09-06 08:51:40] songchongzhan at gmail dot com

Did you disable networking on windows. I use MySQL Query Browser connect
to MySQL, 

it has MySQL Error Number 2003. Use mysqli connect to MySQL, it return
like what 

you post:[2002].

And I use named pipe connect to MySQL by MySQL Query Browser, it is OK,
by php 

5.3.x does not support it util now.

Try to open MySQL network connection.


[2010-07-06 19:10:38] and...@php.net

PLEASE READ THIS : 



http://blogs.iis.net/donraman/archive/2010/06/11/php-5-3-and-mysql-connectivity-problem.aspx


[2010-05-11 08:30:30] kiewic at gmail dot com

Same problem with Windows Vista Ultimate SP2. Why isn't this a bug?


[2010-04-19 04:13:08] sasavilic at gmail dot com

I have same issue. Using Windows 7, 64-bit, IIS



When I try to connect to mysql server on 127.0.0.1 everything works
fine, but with localhost not.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-09-05 Thread songchongzhan at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID: 45150
 Comment by: songchongzhan at gmail dot com
 Reported by:conor dot kerr_php at dev dot ceon dot net
 Summary:MySQL functions cannot be used with 5.3.x on Vista
 when using "localhost"
 Status: Bogus
 Type:   Bug
 Package:MySQL related
 Operating System:   Windows Vista
 PHP Version:5.3CVS-2008-07-23 (snap)
 Block user comment: N

 New Comment:

Did you disable networking on windows. I use MySQL Query Browser connect
to MySQL, 

it has MySQL Error Number 2003. Use mysqli connect to MySQL, it return
like what 

you post:[2002].

And I use named pipe connect to MySQL by MySQL Query Browser, it is OK,
by php 

5.3.x does not support it util now.

Try to open MySQL network connection.


Previous Comments:

[2010-07-06 19:10:38] and...@php.net

PLEASE READ THIS : 



http://blogs.iis.net/donraman/archive/2010/06/11/php-5-3-and-mysql-connectivity-problem.aspx


[2010-05-11 08:30:30] kiewic at gmail dot com

Same problem with Windows Vista Ultimate SP2. Why isn't this a bug?


[2010-04-19 04:13:08] sasavilic at gmail dot com

I have same issue. Using Windows 7, 64-bit, IIS



When I try to connect to mysql server on 127.0.0.1 everything works
fine, but with localhost not.


[2010-04-10 03:58:16] buana95 at yahoo dot com

Same issue on Windows XP SP3 and PHP 5.3.1 with mysqlnd 5.0.5-dev -
081106 - $Revision: 289630 $. 



Work fine when using *libmysql.dll, but can not connect to database when
using *mysqlnd.dll (tested on mysql, mysqli, and PDO extension).



***



>From MySQL website: they have resolved the issue by looping to all
available IP (IPv4 - IPv6) and return the first successful connection.



So, it's must be from PHP streams that fail to resolve IPv6.



Never test on newer PHP version. Sorry.


[2010-04-05 07:52:30] telstra at dark-media dot net

Had the same problem on Windows Server 2008 R2 had to edit the hosts
file and un comment out the 127.0.0.1 localhost



Was stumbled for a while after upgrading from 5.2 to 5.3, this might not
be a bug with PHP but its something that is going to cause issues.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-05-10 Thread kiewic at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID:   45150
 Comment by:   kiewic at gmail dot com
 Reported by:  conor dot kerr_php at dev dot ceon dot net
 Summary:  MySQL functions cannot be used with 5.3.x on Vista
   when using "localhost"
 Status:   Bogus
 Type: Bug
 Package:  MySQL related
 Operating System: Windows Vista
 PHP Version:  5.3CVS-2008-07-23 (snap)

 New Comment:

Same problem with Windows Vista Ultimate SP2. Why isn't this a bug?


Previous Comments:

[2010-04-19 04:13:08] sasavilic at gmail dot com

I have same issue. Using Windows 7, 64-bit, IIS



When I try to connect to mysql server on 127.0.0.1 everything works
fine, but with localhost not.


[2010-04-10 03:58:16] buana95 at yahoo dot com

Same issue on Windows XP SP3 and PHP 5.3.1 with mysqlnd 5.0.5-dev -
081106 - $Revision: 289630 $. 



Work fine when using *libmysql.dll, but can not connect to database when
using *mysqlnd.dll (tested on mysql, mysqli, and PDO extension).



***



>From MySQL website: they have resolved the issue by looping to all
available IP (IPv4 - IPv6) and return the first successful connection.



So, it's must be from PHP streams that fail to resolve IPv6.



Never test on newer PHP version. Sorry.


[2010-04-05 07:52:30] telstra at dark-media dot net

Had the same problem on Windows Server 2008 R2 had to edit the hosts
file and un comment out the 127.0.0.1 localhost



Was stumbled for a while after upgrading from 5.2 to 5.3, this might not
be a bug with PHP but its something that is going to cause issues.


[2010-03-16 13:55:28] achurkin at gmail dot com

Same on Windows 7 Home Edition.

In PHP version 5.2.9 on same system everything works fine.


[2010-03-05 20:51:16] paj...@php.net

That's not a bug, please refer to the dozen other reports about that.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-04-18 Thread sasavilic at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID:   45150
 Comment by:   sasavilic at gmail dot com
 Reported by:  conor dot kerr_php at dev dot ceon dot net
 Summary:  MySQL functions cannot be used with 5.3.x on Vista
   when using "localhost"
 Status:   Bogus
 Type: Bug
 Package:  MySQL related
 Operating System: Windows Vista
 PHP Version:  5.3CVS-2008-07-23 (snap)

 New Comment:

I have same issue. Using Windows 7, 64-bit, IIS



When I try to connect to mysql server on 127.0.0.1 everything works
fine, but with localhost not.


Previous Comments:

[2010-04-10 03:58:16] buana95 at yahoo dot com

Same issue on Windows XP SP3 and PHP 5.3.1 with mysqlnd 5.0.5-dev -
081106 - $Revision: 289630 $. 



Work fine when using *libmysql.dll, but can not connect to database when
using *mysqlnd.dll (tested on mysql, mysqli, and PDO extension).



***



>From MySQL website: they have resolved the issue by looping to all
available IP (IPv4 - IPv6) and return the first successful connection.



So, it's must be from PHP streams that fail to resolve IPv6.



Never test on newer PHP version. Sorry.


[2010-04-05 07:52:30] telstra at dark-media dot net

Had the same problem on Windows Server 2008 R2 had to edit the hosts
file and un comment out the 127.0.0.1 localhost



Was stumbled for a while after upgrading from 5.2 to 5.3, this might not
be a bug with PHP but its something that is going to cause issues.


[2010-03-16 13:55:28] achurkin at gmail dot com

Same on Windows 7 Home Edition.

In PHP version 5.2.9 on same system everything works fine.


[2010-03-05 20:51:16] paj...@php.net

That's not a bug, please refer to the dozen other reports about that.


[2010-03-05 20:46:38] changeorders at gmail dot com

Fresh install of PHP 5.3.x on Server 2008. Same problem. Had to comment
out the IPv6 entry for localhost in the hosts file. This is still a bug.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-04-09 Thread buana95 at yahoo dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID:   45150
 Comment by:   buana95 at yahoo dot com
 Reported by:  conor dot kerr_php at dev dot ceon dot net
 Summary:  MySQL functions cannot be used with 5.3.x on Vista
   when using "localhost"
 Status:   Bogus
 Type: Bug
 Package:  MySQL related
 Operating System: Windows Vista
 PHP Version:  5.3CVS-2008-07-23 (snap)

 New Comment:

Same issue on Windows XP SP3 and PHP 5.3.1 with mysqlnd 5.0.5-dev -
081106 - $Revision: 289630 $. 



Work fine when using *libmysql.dll, but can not connect to database when
using *mysqlnd.dll (tested on mysql, mysqli, and PDO extension).



***



>From MySQL website: they have resolved the issue by looping to all
available IP (IPv4 - IPv6) and return the first successful connection.



So, it's must be from PHP streams that fail to resolve IPv6.



Never test on newer PHP version. Sorry.


Previous Comments:

[2010-04-05 07:52:30] telstra at dark-media dot net

Had the same problem on Windows Server 2008 R2 had to edit the hosts
file and un comment out the 127.0.0.1 localhost



Was stumbled for a while after upgrading from 5.2 to 5.3, this might not
be a bug with PHP but its something that is going to cause issues.


[2010-03-16 13:55:28] achurkin at gmail dot com

Same on Windows 7 Home Edition.

In PHP version 5.2.9 on same system everything works fine.


[2010-03-05 20:51:16] paj...@php.net

That's not a bug, please refer to the dozen other reports about that.


[2010-03-05 20:46:38] changeorders at gmail dot com

Fresh install of PHP 5.3.x on Server 2008. Same problem. Had to comment
out the IPv6 entry for localhost in the hosts file. This is still a bug.


[2008-07-23 13:27:36] conor dot kerr_php at dev dot ceon dot net

Okay,



I've looked into this further and tested with PHP5.2.6 on the same setup
and get the same problem.



I've seen a few bugs in the database which refer to this same
localhost/127.0.0.1 issue.



I agree that it's not a PHP issue.



However, it will become a serious enough issue for people when they move
to 5.3 from a previous version as many PHP-based open source software
packages use "localhost" as their default database server host.



A lot of people will waste a lot of time unless it is made prevalent
somewhere that:



"127.0.0.1" should be used instead of "localhost" on Vista



OR: 



the line "::1  localhost" should be commented out in the hosts file for
Vista: "#::1  localhost"



Where is the best place to put this information? At the very least, it
should be part of the upgrade notes for 5.3 as, I'm willing to bet, many
PHP developers haven't previously used streams and this issue will not
have affected them until they upgrade to 5.3, at which point MySQL will
constantly time out on them because it does use streams and therefore is
susceptible to this windoze bug.



Hopefully there are no "Badly configured OS is not a PHP bug ->
Bogus"-type replies to this, that would not be helpful for the PHP
community at large!



This information needs to be made prevalent somewhere regarding 5.3.



Thanks,



I hope I've been of help to some others!



All the best...



Conor

http://ceon.net




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-04-04 Thread telstra at dark-media dot net
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID:   45150
 Comment by:   telstra at dark-media dot net
 Reported by:  conor dot kerr_php at dev dot ceon dot net
 Summary:  MySQL functions cannot be used with 5.3.x on Vista
   when using "localhost"
 Status:   Bogus
 Type: Bug
 Package:  MySQL related
 Operating System: Windows Vista
 PHP Version:  5.3CVS-2008-07-23 (snap)

 New Comment:

Had the same problem on Windows Server 2008 R2 had to edit the hosts
file and un comment out the 127.0.0.1 localhost



Was stumbled for a while after upgrading from 5.2 to 5.3, this might not
be a bug with PHP but its something that is going to cause issues.


Previous Comments:

[2010-03-16 13:55:28] achurkin at gmail dot com

Same on Windows 7 Home Edition.

In PHP version 5.2.9 on same system everything works fine.


[2010-03-05 20:51:16] paj...@php.net

That's not a bug, please refer to the dozen other reports about that.


[2010-03-05 20:46:38] changeorders at gmail dot com

Fresh install of PHP 5.3.x on Server 2008. Same problem. Had to comment
out the IPv6 entry for localhost in the hosts file. This is still a bug.


[2008-07-23 13:27:36] conor dot kerr_php at dev dot ceon dot net

Okay,



I've looked into this further and tested with PHP5.2.6 on the same setup
and get the same problem.



I've seen a few bugs in the database which refer to this same
localhost/127.0.0.1 issue.



I agree that it's not a PHP issue.



However, it will become a serious enough issue for people when they move
to 5.3 from a previous version as many PHP-based open source software
packages use "localhost" as their default database server host.



A lot of people will waste a lot of time unless it is made prevalent
somewhere that:



"127.0.0.1" should be used instead of "localhost" on Vista



OR: 



the line "::1  localhost" should be commented out in the hosts file for
Vista: "#::1  localhost"



Where is the best place to put this information? At the very least, it
should be part of the upgrade notes for 5.3 as, I'm willing to bet, many
PHP developers haven't previously used streams and this issue will not
have affected them until they upgrade to 5.3, at which point MySQL will
constantly time out on them because it does use streams and therefore is
susceptible to this windoze bug.



Hopefully there are no "Badly configured OS is not a PHP bug ->
Bogus"-type replies to this, that would not be helpful for the PHP
community at large!



This information needs to be made prevalent somewhere regarding 5.3.



Thanks,



I hope I've been of help to some others!



All the best...



Conor

http://ceon.net


[2008-07-23 13:03:04] conor dot kerr_php at dev dot ceon dot net

Hi Andrey,



Thanks for replying. You have found the problem!



Running the following test script:



http://127.0.0.1/foo.txt";);



print "File contents read using 127.0.0.1: \n\n" . $httpfile . "\n\n";



$httpfile  = file_get_contents("http://localhost/foo.txt";);



print "File contents read using localhost: \n\n" . $httpfile . "\n\n";



?>



Gives the following results:



---

File contents read using 127.0.0.1: This is the content of foo.





Warning: file_get_contents(http://localhost/foo.txt)
[function.file-get-contents]: failed to open stream: A connection
attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because
connected host has failed to respond. in
E:\_CEON\Web\test\php_streams.php on line 7



Fatal error: Maximum execution time of 60 seconds exceeded in
E:\_CEON\Web\test\php_streams.php on line 7

---



So PHP 5.3 can't resolve localhost to 127.0.0.1 on Vista.



Should I update this bug to show that it is a streams problem?



Or close this bug and start a new one for Vista + Streams in 5.3?



Thanks again for the reply.



All the best...



Conor




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-03-16 Thread achurkin at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID:   45150
 Comment by:   achurkin at gmail dot com
 Reported by:  conor dot kerr_php at dev dot ceon dot net
 Summary:  MySQL functions cannot be used with 5.3.x on Vista
   when using "localhost"
 Status:   Bogus
 Type: Bug
 Package:  MySQL related
 Operating System: Windows Vista
 PHP Version:  5.3CVS-2008-07-23 (snap)

 New Comment:

Same on Windows 7 Home Edition.

In PHP version 5.2.9 on same system everything works fine.


Previous Comments:

[2010-03-05 20:51:16] paj...@php.net

That's not a bug, please refer to the dozen other reports about that.


[2010-03-05 20:46:38] changeorders at gmail dot com

Fresh install of PHP 5.3.x on Server 2008. Same problem. Had to comment
out the IPv6 entry for localhost in the hosts file. This is still a bug.


[2008-07-23 13:27:36] conor dot kerr_php at dev dot ceon dot net

Okay,



I've looked into this further and tested with PHP5.2.6 on the same setup
and get the same problem.



I've seen a few bugs in the database which refer to this same
localhost/127.0.0.1 issue.



I agree that it's not a PHP issue.



However, it will become a serious enough issue for people when they move
to 5.3 from a previous version as many PHP-based open source software
packages use "localhost" as their default database server host.



A lot of people will waste a lot of time unless it is made prevalent
somewhere that:



"127.0.0.1" should be used instead of "localhost" on Vista



OR: 



the line "::1  localhost" should be commented out in the hosts file for
Vista: "#::1  localhost"



Where is the best place to put this information? At the very least, it
should be part of the upgrade notes for 5.3 as, I'm willing to bet, many
PHP developers haven't previously used streams and this issue will not
have affected them until they upgrade to 5.3, at which point MySQL will
constantly time out on them because it does use streams and therefore is
susceptible to this windoze bug.



Hopefully there are no "Badly configured OS is not a PHP bug ->
Bogus"-type replies to this, that would not be helpful for the PHP
community at large!



This information needs to be made prevalent somewhere regarding 5.3.



Thanks,



I hope I've been of help to some others!



All the best...



Conor

http://ceon.net


[2008-07-23 13:03:04] conor dot kerr_php at dev dot ceon dot net

Hi Andrey,



Thanks for replying. You have found the problem!



Running the following test script:



http://127.0.0.1/foo.txt";);



print "File contents read using 127.0.0.1: \n\n" . $httpfile . "\n\n";



$httpfile  = file_get_contents("http://localhost/foo.txt";);



print "File contents read using localhost: \n\n" . $httpfile . "\n\n";



?>



Gives the following results:



---

File contents read using 127.0.0.1: This is the content of foo.





Warning: file_get_contents(http://localhost/foo.txt)
[function.file-get-contents]: failed to open stream: A connection
attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because
connected host has failed to respond. in
E:\_CEON\Web\test\php_streams.php on line 7



Fatal error: Maximum execution time of 60 seconds exceeded in
E:\_CEON\Web\test\php_streams.php on line 7

---



So PHP 5.3 can't resolve localhost to 127.0.0.1 on Vista.



Should I update this bug to show that it is a streams problem?



Or close this bug and start a new one for Vista + Streams in 5.3?



Thanks again for the reply.



All the best...



Conor


[2008-07-23 11:24:54] and...@php.net

Hi,

mysqlnd uses the PHP streams, compared to libmysql, which does the
network i/o itself. Thus, if mysqlnd can't resolve localhost to
127.0.0.1, then PHP should not be able too. Could you try to reproduce
that. mysqlnd does nothing special, just uses IPv4 to open a TCP
connection.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=45150


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=45150&edit=1


Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-03-05 Thread
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID:   45150
 Comment by:   
 Reported by:  conor dot kerr_php at dev dot ceon dot net
 Summary:  MySQL functions cannot be used with 5.3.x on Vista
   when using "localhost"
 Status:   Closed
 Type: Bug
 Package:  MySQL related
 Operating System: Windows Vista
 PHP Version:  5.3CVS-2008-07-23 (snap)

 New Comment:

Fresh install of PHP 5.3.x on Server 2008. Same problem. Had to comment
out the IPv6 entry for localhost in the hosts file. This is still a bug.


Previous Comments:

[2008-07-23 13:27:36] conor dot kerr_php at dev dot ceon dot net

Okay,



I've looked into this further and tested with PHP5.2.6 on the same setup
and get the same problem.



I've seen a few bugs in the database which refer to this same
localhost/127.0.0.1 issue.



I agree that it's not a PHP issue.



However, it will become a serious enough issue for people when they move
to 5.3 from a previous version as many PHP-based open source software
packages use "localhost" as their default database server host.



A lot of people will waste a lot of time unless it is made prevalent
somewhere that:



"127.0.0.1" should be used instead of "localhost" on Vista



OR: 



the line "::1  localhost" should be commented out in the hosts file for
Vista: "#::1  localhost"



Where is the best place to put this information? At the very least, it
should be part of the upgrade notes for 5.3 as, I'm willing to bet, many
PHP developers haven't previously used streams and this issue will not
have affected them until they upgrade to 5.3, at which point MySQL will
constantly time out on them because it does use streams and therefore is
susceptible to this windoze bug.



Hopefully there are no "Badly configured OS is not a PHP bug ->
Bogus"-type replies to this, that would not be helpful for the PHP
community at large!



This information needs to be made prevalent somewhere regarding 5.3.



Thanks,



I hope I've been of help to some others!



All the best...



Conor

http://ceon.net


[2008-07-23 13:03:04] conor dot kerr_php at dev dot ceon dot net

Hi Andrey,



Thanks for replying. You have found the problem!



Running the following test script:



http://127.0.0.1/foo.txt";);



print "File contents read using 127.0.0.1: \n\n" . $httpfile . "\n\n";



$httpfile  = file_get_contents("http://localhost/foo.txt";);



print "File contents read using localhost: \n\n" . $httpfile . "\n\n";



?>



Gives the following results:



---

File contents read using 127.0.0.1: This is the content of foo.





Warning: file_get_contents(http://localhost/foo.txt)
[function.file-get-contents]: failed to open stream: A connection
attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because
connected host has failed to respond. in
E:\_CEON\Web\test\php_streams.php on line 7



Fatal error: Maximum execution time of 60 seconds exceeded in
E:\_CEON\Web\test\php_streams.php on line 7

---



So PHP 5.3 can't resolve localhost to 127.0.0.1 on Vista.



Should I update this bug to show that it is a streams problem?



Or close this bug and start a new one for Vista + Streams in 5.3?



Thanks again for the reply.



All the best...



Conor


[2008-07-23 11:24:54] and...@php.net

Hi,

mysqlnd uses the PHP streams, compared to libmysql, which does the
network i/o itself. Thus, if mysqlnd can't resolve localhost to
127.0.0.1, then PHP should not be able too. Could you try to reproduce
that. mysqlnd does nothing special, just uses IPv4 to open a TCP
connection.


[2008-07-18 16:54:54] conor dot kerr_php at dev dot ceon dot net

Hi,



Finally got this sorted.



Took a more methodical debugging attitude to this and reduced the
mysql.connect_timeout to 5 seconds.



Started to get error messages at last - so the mysql_connect function
that wasn't failing altogether.



Quickly determined that on Vista SP1, PHP5.3 can't resolve "localhost"
to "127.0.0.1" in the mysql_connect function.



Stopping Apache, pointing LoadModule php5_module ... and PHPIniDir ...
back to 5.2.x then restarting Apache allows the mysql_connect function
to work again (as expected).



This is using a stock hosts file on Windoze, which is correctly set up
for localhost.



I'm not sure where the bug is but could it possibly be something to do
with IPv6? Does PHP5.3's new mysqlnd default to using IPv6 first which
then isn't resolving properly to 127.0.0.1? I only ask that as 5.2.6
works perfectly on the same machine(s) and the only difference I can see
is the use of mysqlnd.



I could be barking up the wrong