|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46842 calls to mysql_connect crash
Submitted: 2008-12-12 07:58 UTC Modified: 2009-01-06 21:52 UTC
Avg. Score:4.8 ± 0.7
Reproduced:8 of 8 (100.0%)
Same Version:8 (100.0%)
Same OS:6 (75.0%)
From: pdp2108 at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.8 OS: win32 only - Windows XP SP2
Private report: No CVE-ID: None
 [2008-12-12 07:58 UTC] pdp2108 at gmail dot com
I have an isolated test case that reliably generates a segmentation fault in php5ts.dll. 

Here is the environment:

Windows XP, SP2, Single Athlon 64 3200+ CPU, 1 GB RAM

MySQL version 5.1.30 for Win32
Apache version 2.2.10 for Win32
PHP 5.2.8

PHP was installed with the .msi installer.  The following extensions were added at installation:  GD, mysql, mysqli and multi-byte string.

I have configured Apache & MySQL and have created some databases, which I can access through mysql and Navicat.  I have used a simple phpinfo.php script to track down an incorrect libmysql.dll in my path and have eliminated that and have verified that the client version of libmysql is 5.1.30 in phpinfo.

Reproduce code:
mysql_connect('localhost', 'root', 'root');
print('Past mysql_connect');

Expected result:
One expects to see the "Past mysql_connect" statement print out.

Actual result:
Thread 0 - System ID 4232
Entry point   php!mainCRTStartup 
Create time   12/12/2008 2:17:59 AM 
Time spent in user mode   0 Days 0:0:0.0 
Time spent in kernel mode   0 Days 0:0:0.31 

Function     Arg 1     Arg 2     Arg 3   Source 
php5ts!zend_mm_search_large_block+fa     00f35230     00000048     0000001c    
php5ts!_zend_mm_alloc_int+153     00000000     0000003f     1009ba69    
php5ts!_emalloc+39     0000003f     0111c4c8     00f327a0    
php5ts!_zend_hash_add_or_update+2d9     00f36148     0111c4e0     0000001c    
php_mysql!php_mysql_do_connect+867     0111c460     0111c4c8     00000000    
php_mysql!zif_mysql_connect+25     00000003     0111c4c8     00000000    
php5ts!zend_do_fcall_common_helper_SPEC+7d9     00c0fbd0     00f327a0     0111be8c    
php5ts!ZEND_DO_FCALL_SPEC_CONST_HANDLER+e5     00000000     00f327a0     00f327a0    
php5ts!execute+1c5     0111be98     00f327a0     00000000    
php5ts!zend_execute_scripts+107     00000008     00f327a0     00000000    
php5ts!php_execute_script+20d     00c0fec8     00f327a0     0000000e    
php!main+bca     00000003     00f33fd0     00f32d60    
php!mainCRTStartup+e3     0000000e     00000000     7ffdf000    
kernel32!BaseProcessStart+23     00402f72     00000000     00000000    

PHP5TS!ZEND_MM_SEARCH_LARGE_BLOCK+FAIn php__PID__3284__Date__12_12_2008__Time_02_18_29AM__734__Second_Chance_Exception_C0000005.dmp the assembly instruction at php5ts!zend_mm_search_large_block+fa in C:\PHP\php5ts.dll from The PHP Group has caused an access violation exception (0xC0000005) when trying to read from memory location 0x00000014 on thread 0

Module Information 
Image Name: C:\PHP\php5ts.dll   Symbol Type:  PDB 
Base address: 0x10000000   Time Stamp:  Mon Dec 08 14:31:08 2008  
Checksum: 0x00000000   Comments:   
COM DLL: False   Company Name:  The PHP Group 
ISAPIExtension: False   File Description:  PHP Script Interpreter 
ISAPIFilter: False   File Version: 
Managed DLL: False   Internal Name:  php5ts.dll 
VB DLL: False   Legal Copyright:  Copyright ? 1997-2007 The PHP Group 
Loaded Image Name:  php5ts.dll   Legal Trademarks:  PHP 
Mapped Image Name:  C:\PHP\php5ts.dll   Original filename:  php5ts.dll 
Module name:  php5ts   Private Build:   
Single Threaded:  False   Product Name:  PHP Script Interpreter 
Module Size:  4.98 MBytes   Product Version:  5.2.8 
Symbol File Name:  C:\PHP_Debug\php5ts.pdb   Special Build:  & 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-15 21:19 UTC] adrian at cozuweb dot com
I have exactly the same problem, just my Apache server version is 2.2.11.

just wanted to add that if I run the script using the cli (php.exe) :

php -f dbtest.php
it works perfectly.
If I access the same file using the web server I get the access violation.

The content of dbtest.php is:
  $connection = mysql_connect("ponchs","root","At1fT43"); 
 echo "$connection";
I started with a clean installation of the three packages, everything else seems to be running fine
 [2008-12-16 18:22 UTC] michail1982 at gmail dot com
I not shure, that is a PHP bug... Thats happends, when i use libMysql.dll from Mysql source.. when i use this dll from prevous Mysql (5.0.51b) it`s OK
PS go to Mysql site :)

PPS Sorry? my english is bad
 [2008-12-26 04:05 UTC] yottabytewizard at mybboard dot net
Had this problem too.

The new libmysql.dll seems to be messed up. I ended using the libmysql.dll version included in PHP 5.2.6.

I just upgraded to the latest versions of Apache(2.2.11), PHP (5.2.8) and MySQL (5.1.11), but using the dll from php 5.2.6.
 [2009-01-06 21:16 UTC] savitski at mail dot ru
The problem appears if and only if the Apache process uses another libmysql.dll than shipped with PHP 5.2.8 package.

To solve the problem keep only libmysql.dll in PHP home dir and delete others.

Of course you could check which dll is used before you start delete (for example with help of freeware "Process Explorer" from Microsoft site). In my case the DLL was loaded from MySQL installation path but not PHP.
 [2009-01-06 21:52 UTC]
Never use other DLLs than the one we ship.
 [2010-03-21 12:33 UTC] anatoly dot deryshev at gmail dot com
You must copy libmysql.dll from php installation folder to apache bin folder
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 12:01:29 2024 UTC