icyfire624 Posted March 22, 2006 Share Posted March 22, 2006 I used PHP->"C++ shared object(*.so)"->unixODBC->myodbc->mysql architecture. I executed "php test.php" at command line. Then I got "segment fault" on tty.I apply ODBC trace log. I found SQLConnect succeeded but SQLExecDirect was failed at the first "SELECT" statement.I traced into unixODBC and found no return from myodbc's SQLEXECDIRECT. It seems dead in myodbc.I had not traced into myodbc since no source code of myodbc. I installed myodbc with binary code. Furthermore, I used "C binary: main()"->"C++ shared object(*.so)"->unixODBC->myodbc->mysql architecture to test. Everything is OK. SQLExecDirect succeeded at every "SELECT" statement. The "SELECT" statement is the same as php execution mode. I saw they are coincident in ODBC trace log. The environment is: Login linux with "root". Connect ODBC with "DSN=testdb;UID=root;PWD=;". There is no password for "root" of mysql. Some versions:myodbc-connector 3.51.12unixODBC 2.2.11mysql Ver 11.18 Distrib 3.23.54, for redhat-linux-gnu (i386) PHP 4.4.2 (cli) (built: Mar 19 2006 15:50:38)Copyright © 1997-2006 The PHP GroupZend Engine v1.3.0, Copyright © 1998-2004 Zend Technologies gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)Copyright © 2002 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.Built for i386-redhat-linux-gnuCopyright © 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.This is free software; see the source for copying conditions.There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR APARTICULAR PURPOSE. Report bugs to <bug-make@gnu.org>. Quote Link to comment https://forums.phpfreaks.com/topic/5489-help-error-when-php-so-myodbc-mysql/ Share on other sites More sharing options...
icyfire624 Posted March 25, 2006 Author Share Posted March 25, 2006 I traced into myodbc and found it was caused by charset setting. When I use exec-file built from C source code to test, the charset is "latin1". And when I use "php test.php" to test, the charset struct parameter is null pointer. SQLDriverConnect passed but SQLExecDirect failed. When SQLDriverConnect, "mysql_real_connect" said: | | | >get_charsets_dir | | | | info: charsets dir='NONEXISTENT/charsets/' I configed the php.ini and add "default-charset=latin1". But the failure is the same. Who can tell me how to set the charset for php->odbc->mysql? Quote Link to comment https://forums.phpfreaks.com/topic/5489-help-error-when-php-so-myodbc-mysql/#findComment-20478 Share on other sites More sharing options...
icyfire624 Posted April 1, 2006 Author Share Posted April 1, 2006 I have not resolved the problem yet.After tracing, I found two different test way caused different call of "mysql_init" and other mysql client api:When I use "a.out" built from C source code (a.out->my.so->iodbc->myodbc->mysql) to test, it used "mysql-init" within the libmysqlclient.so.When I use "php test.php" (php->my.so->iodbc->myodbc->mysql) to test, it used "mysql_init" within "php". "php" client contained a "mysql_init" from its "ext/mysql".So strange. And I have not found how to deal with it.Please help me. Quote Link to comment https://forums.phpfreaks.com/topic/5489-help-error-when-php-so-myodbc-mysql/#findComment-22840 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.