Bug #7040 Using php with MyODBC causes segfault
Submitted: 6 Dec 2004 15:39 Modified: 26 Oct 2005 21:50
Reporter: Bostjan Lah Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:4.1.7 OS:Linux (Fedora Core 3)
Assigned to: CPU Architecture:Any

[6 Dec 2004 15:39] Bostjan Lah
Description:
Using stock FC3 php (with php-odbc) and MySQL 4.1.7 (RPMS downloaded from mysql.com) causes a segfault during odbc_connect with MyODBC-3.51.09.
The php script is very simple:
<?php
$conn = odbc_connect("testdb", "", "");
?>
With the following in odbc.ini:
[ODBC Data Sources]
testdb     = MySQL ODBC 3.51 Driver DSN

[testdb]
Driver       = /usr/lib/libmyodbc3.so
Description  = MySQL ODBC 3.51 Driver DSN
SERVER       = localhost
PORT         =
USER         = bos
Password     =
Database     = test
OPTION       = 3
SOCKET       =

Running php cli under gdb gives me the following backtrace:
#0  0xb7704a54 in strxmov () from /usr/lib/libmysqlclient.so.10
#1  0xb75c9427 in SQLConnect () from /usr/lib/libmyodbc3.so
#2  0xb76882b6 in SQLConnect () from /usr/lib/libodbc.so.1
#3  0xb772985a in odbc_sqlconnect () from /usr/lib/php4/odbc.so
#4  0xb7729dc7 in odbc_do_connect () from /usr/lib/php4/odbc.so
#5  0xb772a063 in zif_odbc_connect () from /usr/lib/php4/odbc.so
#6  0x08154f4c in execute ()
#7  0x08144400 in zend_execute_scripts ()
#8  0x0811b6be in php_execute_script ()
#9  0x00000000 in ?? ()

Maybe the cause is the fact that MySQL-shared-compat libraries are installed and not MySQL-shared?

Also interesting is that when I give username and a password as part of odbc_connect it doesn't segfault but gives me the following message instead:
PHP Warning:  odbc_connect(): SQL error: [unixODBC][MySQL][ODBC 3.51 Driver]Client does not support authentication protocol requested by server; consider upgrading MySQL client, SQL state S1000 in SQLConnect in t1.php on line 9

How to repeat:
Install MySQL 4.1.7 and MyODBC on FC3 (including MySQL-shared-compat package).
Add above lines into the odbc.ini (swapping username for one with access)
Run provided sample script.
[11 Jan 2005 5:47] Jorge del Conde
Thanks for the bug-report.
[26 Oct 2005 21:50] Jorge del Conde
I was unable to reproduce this bug using FC4 and 3.51.12
[27 Oct 2005 7:06] Bostjan Lah
I also no longer have FC3 - no way to try it.
[15 Jun 2006 22:02] Robert Toole
I can duplicate this bug... 

Please see http://bugs.centos.org/view.php?id=1288

I have recently set up a test box, so am once again able to do testing....