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
No comments at this timeMake yourself heard