|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42056 Does not compile with mysqli
Submitted: 2007-07-20 22:11 UTC Modified: 2007-07-21 16:15 UTC
From: givanz at yahoo dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.2.3 OS: CentOS 4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: givanz at yahoo dot com
New email:
PHP Version: OS:


 [2007-07-20 22:11 UTC] givanz at yahoo dot com
When i compile php with mysql or mysqli extension it doesn't work

i have mysql 5.0.45 is this version suported ?

//compile command

./configure --prefix=/home/web/php --with-apxs2=/home/web/apache/bin/apxs --enable-sockets --with-zip --enable-mbstring --with-zlib --without-sqlite --enable-spl --with-mysqli=/home/web/mysql/bin/mysql_config --without-pear --disable-cgi  && make && make install

//last lines

checking for MSSQL support via FreeTDS... no
checking for MySQL support... no
checking for specified location of the MySQL UNIX socket... no
checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
checking for mysql_set_server_option in -lmysqlclient_r... no
configure: error: wrong mysql library version or lib not found. Check config.log for more information.


configure:58392: checking for MySQL support
configure:58438: checking for specified location of the MySQL UNIX socket
configure:59597: checking for MySQLi support
configure:59643: checking whether to enable embedded MySQLi support
configure:59793: checking for mysql_set_server_option in -lmysqlclient_r
configure:59812: gcc -o conftest -I/usr/include -O3 -march=pentium4 -pipe -ftracer -fforce-addr -falign-functions=32 -mfpmath=sse -fprefetch-loop-arrays -momit-leaf-frame-pointer -fomit-frame-pointer -ffast-math -fexpensive-optimizations -mmmx -msse -msse2 -D_FORTIFY_SOURCE=2 -pthread  -D_REENTRANT -Wl,-rpath,/home/web/mysql/lib/mysql -L/home/web/mysql/lib/mysql -L/usr/lib  -lmysqlclient_r -lz -lcrypt -lnsl -lm conftest.c -lmysqlclient_r  -lz -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
configure: failed program was:
#line 59801 "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_set_server_option();

int main() {
; return 0; }


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-20 22:28 UTC]
What does this output:

# /home/web/mysql/bin/mysql_config --libs_r

 [2007-07-21 06:24 UTC] givanz at yahoo dot com
# /home/web/mysql/bin/mysql_config --libs_r

//output is 

-L/home/web/mysql/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread
 [2007-07-21 13:05 UTC]
Do you have any LDFLAGS or CFLAGS set prior to running configure or in your environment?
 [2007-07-21 13:36 UTC] givanz at yahoo dot com
I found the problem

Php searches mysqclient_r library and with default compilation mysql only compiles mysqlclient 

so i compiled mysql with --enable-thread-safe-client and then the compilation of php worked fine.

I don't know why php wants mysqlclient_r and it doesn't compile with mysqlclient.
 [2007-07-21 16:15 UTC]
There is no bug in PHP. It's doing exactly what it should be when building a thread-safe module for your Apache (which is obviously not configured to run prefork MPM..) and tries to link with the thread-safe mysql library.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 02:01:30 2024 UTC