Solution for "configure: error: wrong mysql library version or lib not found" "/usr/bin/ld: cannot find -lmysqlclient_r" php compile error.
I got into this problem recenly when I was trying to compile php on my web server
I ran my ./configure script
./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
And I got this errors
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.
This was because I compiled apache with "--with-mpm=worker" instead of "--with-mpm=prefork" and php requierd a multi threaded mysql client library
So I fixed the problem by compiling mysql with "--enable-thread-safe-client". After that, php compiled fine
./configure --prefix=/home/web/mysql --with-charset=utf8 --with-collation=utf8_general_ci --without-innodb --without-debug --enable-assembler --with-mysqld-user=mysql --with-tcp-port=7777 --enable-thread-safe-client && make && make install
Share this with the world
Related
Comments
hello there,
Posted on 2009-12-14 06:17:10Compilation error during compiling code cannot find -lmysqlclient_r checked every thing but could get it. please help.
thanks.
Hi, I must admit that this blog on Php mysql client library compilation problem is really nice. Though the para 1 is introductory, the most beautiful thing I liked about it is the conclusion part. You have concluded in an unbiased way presenting the facts about Php mysql client library compilation problem.
Posted on 2010-05-05 11:57:25Make yourself heard