Red Hat Bugzilla – Bug 205718
memory corruption on php odbc_exec call to mysql
Last modified: 2014-12-01 18:08:23 EST
Description of problem:
Making an odbc call from within a php script to a mysql database under RHEL
fails with a crash.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create an ODBC dsn to connect to a mysql database like:
Description = MySQL
Driver = MySQL
Server = localhost
Database = test
Port = 3306
2. Create a php script to query that database using odbc calls like:
*** glibc detected *** malloc(): memory corruption: 0x08882200 ***
connect to the database succesfully
I have tried to trace this problem down on the MySQL and PHP bug trackers and it
is hard to know where the issue really lies. I have tried many different
version combinations of php, mysql and the odbc-connector. ONE COMBINATION DOES
WORK: using mysql-connector-odbc-3.51.12-1 and mysql-4.1.12-3.RHEL4.1
as soon as you upgrade to mysql-4.1.20-1 the same exact setup starts to fail.
Issue persists on newest MySQL rpms from mysql.org and php5.1
***this NEVER works with RHEL out of the box***
there are a couple of other people out there who have seen similar things. bug
171064 seems to be a special case of this problem. There is a much fuller
description using the centos4 rpms for mysql5 at:
Upgrading to mysql-odbc-connector does change the bug from a memory corruption
bug to a segmentation fault. nevertheless with Update 4 upgrading mysql to
4.1.20 there is no way to get an odbc connection under php.
I know nearly zip about php. Would you mind providing a complete test case,
that is a php script that triggers the problem and an example of how to run it?
ok, a more complete test case. On a fresh RHEL4 update 4 install:
1. start mysqld (service mysqld start). this assume you haven't created any
tables or set any passwords. your "test" database will be there, but myodbc
won't even make it that far.
2. edit /etc/odbc.ini to include the entry from (1) above
2a. you /etc/odbcinst.ini file should have an entry that looks like:
Description = MySQL Connector 2.5
Driver = libmyodbc.so
Setup = libodbcmyS.so
UsageCount = 1
FileUsage = 1
3. open a text editor, copy and paste the following, name it test.php:
$connect = odbc_connect("localtest", "root", "");
$result = odbc_exec($connect, "use test;") or die ("Query Failed.");
4. execute it (php ./test.php)
you'll see the output:
*** glibc detected *** malloc(): memory corruption: 0x0854d638 ***
or something similar
Hmm ... it suddenly occurs to me that maybe this is the same problem diagnosed and fixed in bug
#185343, which would make it MyODBC's fault not mysql's.
might be MyODBC's fault, but since it works in some configurations and not
others while leaving mysql-connector-odbc constant it at least seems to be an
on a further note, this bug seems to have disappeared in RHEL5. still present
in 4.5 though
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life.
Please See https://access.redhat.com/support/policy/updates/errata/
If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.