php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50356 mysql_connect timeout / server reset when executing as module
Submitted: 2009-12-01 21:02 UTC Modified: 2009-12-28 00:22 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:3 (100.0%)
From: monochromec at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.11 OS: Windows 7
Private report: No CVE-ID: None
 [2009-12-01 21:02 UTC] monochromec at gmail dot com
Description:
------------
When executing mysql_connect with 5.2.11 running as a module under Apache 2.2.14 on a Windows 7 platform, mysql_connect times out and the browser reports "connection reset" or similar depending on the used browser. This behaviour was first observed with phpMyAdmin 3.2.3 (file library/dbi/mysql.dbi.lib.php, line 38). When changing the invocation type from module to (f)cgi, the problem disappears. This behaviour is reproducible with 5.3.1 (vc6-x86). MySQL is version 5.1, client side 5.0.51a (as reported by phpinfo).

Reproduce code:
---------------
Cf. mysql.dbi.lib.php



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-01 21:10 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2009-12-06 12:49 UTC] jonathan at techcube dot net
Same problem with 64bit windows 7.
Sample code:
http://sg.php.net/manual/en/mysql.examples-basic.php

This would show the problem.
As long as mysql_connect() is present, the problem would occur.
 [2009-12-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-12-27 21:03 UTC] j dot amend at gmail dot com
Config:
Windows 7 x64
Apache 2.2.14 x86 using php5_module
PHP 5.3.1 thread safe x86 VC6
MySQL 5.1 x86

Doesn't work:

<?php
mysql_connect('localhost');
?>

mysql_errno(): 2002
mysql_error(): 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.

This works:

<?php
mysql_connect('127.0.0.1');
?>

I'm thinking this has something to do with IPv6 (localhost is resolving to ::1 when I ping it).

Clients like mysql's CLI (mysql -h localhost) connect without issues.
 [2009-12-28 00:22 UTC] rasmus@php.net
Connect to 127.0.0.1 instead or fix your OS to provide an ipv4 address 
for "localhost" instead of just ::1 which is likely what you have right 
now.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Aug 23 09:01:27 2019 UTC