error: Cannot find libmysqlclient_r under /usr/local/mysql - PHP Compile Error




Error:

In a x86_64 OS,
While configuring PHP using:

--with-mysql=/usr/local/mysql

checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient_r under /usr/local/mysql.
Note that the MySQL client library is not bundled anymore!

Solution:

When configuring PHP for x86_64, it is necessary to use:
--with-libdir=lib64

When you compile MySQL from source, it does not place its files in lib64, but rather lib.

Here in my case i have configured MySQL using:
--prefix=/usr/local/mysql

When you entered the /usr/local/mysql directory, you can find 'lib' in there, but in the 64 bit os, PHP compilation forced to check for 'lib64' directory in mysql home directory to compile php with mysql.

ie,
When PHP is configured using --with-mysql=/usr/local/mysql and --with-libdir=lib64, it should search for /usr/local/mysql/lib64, since there is no such directory there encountered an error in PHP compile.

Since MYSQL is compiled from source, there will not be a 'lib64', the following steps will solve this problem.

[root@vps ~]# cd /usr/local/mysql  #Change directory to mysql's home directory
[root@vps mysql]# ln -s lib lib64    #Create a link for lib to lib64


That's it...

This entry was posted in by Unknown. Bookmark the permalink.

Leave a Reply