LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   mysql_connect crashes php (https://www.linuxquestions.org/questions/slackware-14/mysql_connect-crashes-php-546612/)

DavidHB 04-16-2007 08:00 PM

mysql_connect crashes php
 
I installed apache and php from www.packages.slackware.it on my Slackware 10.1 2.6.13 kernel. Phpinfo() tells me I've got Apache 1.3.33, php 4.1.10 and mysql 4.1.14

Originally I received errors in the log indicating that it couldn't find libmysqlclient.so.12. The only mysqlclient I had was libmysqlclient.so.14.0.0 and in a different directory than where it was looking, so I linked to .14, calling it libmysqlclient.so.12.

It seemed better, at least mysql was recognized in phpinfo() now. But I get *** glibc detected *** corrupted double linked list, and the page dies when I try to call mysql_connect. Is it becasue I´m using a .14 client as .12?

phpinfo says:

Active Persistent Links 0
Active Links 0
Client API version 4.1.14
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/run/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient


mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off


Whasup?

Thx

willysr 04-16-2007 08:08 PM

Slackware have an official package for Apache, MySQL, and PHP. Why don't you use that?

DavidHB 04-17-2007 07:55 AM

I managed to isolate the problem a little further! It's not really "mysql_connect" that's causing the problem, its "mysql_select_db". I enabled mysql trace and it indicated that I was connecting to the mysql. If I use my original test database that I created manually, mysql_select_db is fine. Of course the rest of the program croaks because it is expecting a different DB.

The DBase I am trying to use was imported via script from a test site. I can access it manually and it seems intact, but with mysql_select_db, I get *** glibc errors ****

As far as why I don't use the Slackware pkg, it's too long a story and not all that relevant, but partly to do with the hardware (small embedded platform with not much space and a difficult hardware disc combination etc. etc.)

willysr 04-17-2007 08:13 PM

that's strange
if you managed to connect to the DB and it went fine, why would selecting a DB cause a GLIBC error?

Hm... have you tried to compile your own PHP?
I usually used a source code version for PHP and leave the rest (Apache and MySQL) from Slackware official package.

DavidHB 04-18-2007 08:06 AM

could it be "ln libmysqlclient.so.14.0.0 libmysqlclient.so.12"?
 
The saga continues and takes a turn which changes the suspected cause of the failure. In the interest of any who might be looking to this post in the future for answers to a connection problem with mysql from php, there is no answer, it connects, the problem is farther along.

In any case, it's an interesting case of a debug situation and the problem is very strange.

The crash happens once the program gets past a query ( as a result of having access to all the tables it needs). Even with all the trace tags enabled, the crash "seemingly" happened before (making it seem like the failure was the connection etc) because the code would crash the program before the output got to the browser. Commenting out the appropriate sections the crash point could be isolated better letting the debug strings get to the browser.

At this point, if I leave the program intact but put an "echo" of the sql string to the browser before the query, the program doesn't crash!! Everything else is the same. The echo doesn't have to be the sql string, it can be any text of 70 char or more. Less text and it crashes. I've never seen anything like it. I thought perhaps it was that the echo produced a delay that perhaps permitted a complete connection before the query (??), but I tried a delay just in case, but no.

Might there be a problem in that I'm linking the libmysqlclient.so.14.0.0 to libmysqlclient.so.12 that php is looking for? If so which version php looks for the .14 client?


All times are GMT -5. The time now is 08:45 PM.