php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48715 Configure php with mysql result "configure: error: mysql configure failed"
Submitted: 2009-06-29 09:29 UTC Modified: 2009-06-30 21:33 UTC
From: amiroot at yahoo dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.10 / 5.3 CVS OS: RedHat EL5 64bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: amiroot at yahoo dot com
New email:
PHP Version: OS:

 

 [2009-06-29 09:29 UTC] amiroot at yahoo dot com
Description:
------------
While doing configure in php-5.2.10 (also happened in PHP 5.3 RC4 and the latest CSV). It works prefectly okay in PHP 5.2.9.

I installed both 32 and 64 version of libmysqlclient.so which located in
/usr/lib/mysql and /usr/lib64/mysql respectively. Sounds like the
configure script seek for only /usr/lib/mysql. Here is the error in
config.log

configure:60459: gcc -o conftest -I/usr/include -g -O2 -pthread 
-D_REENTRANT -Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql -L/usr/lib 
-Wl,-rpath,/usr/kerberos/lib64 -L/usr/kerberos/lib64 -Wl,-rpath,/usr
-L/usr conftest.c -lmysqlclient_r  -lz -lmcrypt -lltdl -lcrypt -lpam
-lfreetype -lpng -lz -ljpeg -lgdbm -lcurl -lz -lresolv -lm -ldl -lnsl 
-lxml2 -lz -lm -lcurl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv
-ldl -lidn -lssl -lcrypto -lz -lxml2 -lz -lm -lgssapi_krb5 -lkrb5
-lk5crypto -lcom_err -lssl -lcrypto -ldl -lz 1>&5
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient_r.so
when searching for -lmysqlclient_r
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient_r.a
when searching for -lmysqlclient_r
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
configure: failed program was:
#line 60448 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_error();

int main() {
mysql_error()
; return 0; }


Reproduce code:
---------------
./configure --with-apxs2=/usr/local/httpd/bin/apxs --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr --with-zlib --enable-ftp --enable-sockets --enable-mbstring=all --enable-zip --enable-soap --with-iconv --with-gdbm --with-mcrypt --with-imap --with-kerberos --with-imap-ssl --with-curl --with-mysql

Expected result:
----------------
No error

Actual result:
--------------
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-29 09:42 UTC] jani@php.net
1. Change to prefork MPM in Apache
2. Try again.
 [2009-06-29 11:17 UTC] amiroot at yahoo dot com
I tried even ./configure --with-mysql --with-zlib-dir=/usr but the problem still exists.
 [2009-06-29 11:57 UTC] jani@php.net
Try this instead:

# rm config.cache
# ./configure --disable-all --with-mysql
 [2009-06-29 12:04 UTC] amiroot at yahoo dot com
Here you go~

checking for mysql_close in -lmysqlclient... no
checking for mysql_errno in -lmysqlclient... no
configure: error: Try adding --with-zlib-dir=<DIR>. Please check config.log for more information.

The same "cannot find -lmysqlclient" error appear in config.log
 [2009-06-29 20:40 UTC] jani@php.net
And did you try adding the obvious I omitted? (--with-zlib-dir..) 
I find it kinda hard to believe this would be any PHP bug since the 
config.m4 in ext/mysql has not changed between 5.2.9 and 5.2.10.
 [2009-06-30 01:54 UTC] amiroot at yahoo dot com
Same result even I added --with-zlib-dir. So do the error in config.log.

I think the problem is that the configure cannot find the library in xx/lib64/mysql folder even I removed the one in xx/lib64/mysql. Can we have an option to specify the location of the library? Because in some case the 32 bit and 64 bit version library may coexists for compatibility sake.

And I believe I'm not alone. I found a very similar bug before (http://bugs.php.net/bug.php?id=47972). I open this bug because I can't reopen that bug. I believed that the 2 case might be merged.
 [2009-06-30 08:23 UTC] jani@php.net
You did what now to the libs? Please try installing mysql properly. I doubt you can't build 5.2.9 either now. I have Centos5 with properly installed mysql libs and everything work just fine.
 [2009-06-30 15:45 UTC] amiroot at yahoo dot com
Sorry I recalled how I did it. I used to installed only 64bit version and make a symlink of /usr/lib64/mysql to /usr/lib/mysql. Once I removed the symlink and install the 32bit the configure got failed. Once I removed the 32bit and create a symlink again it works :p

FYI I installed the mysql libraries through RPM.
 [2009-06-30 21:33 UTC] jani@php.net
Faulty installations of mysql are not PHP bugs, they're either packager 
bugs or Mysql bugs.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 18 09:01:27 2025 UTC