configure: error: Cannot find libmysqlclient under /usr

I received the below error when compiling PHP¬†to work as an external application with the Litespeed API. When you do compile this it’s called the PHP LSAPI module which is then used by Litespeed to process PHP.

PHP Build Error:

configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!

The issue was that I the MySQL server version was 64-bit and the php compile script was looking for 32-bit libraries. To see if your MySQL server is 64-bit or 32-bit check the version by issuing the below command and looking for a response also shown below.

MySQL Version:

[root@server php-5.2.8]# mysql --version
mysql Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (x86_64) using readline 5.0

To resolve the issue add the below configuration options to your PHP configure script.

Options to Add:

--with-mysql=/usr/bin/ --with-libdir=lib64

So my PHP configure script after adding these options now looked like the below which resolve the compile error.

PHP Configure Script:

./configure --prefix=/var/lsws/lsphp5 --with-litespeed --with-mysqli --with-mcrypt --with-mysql=/usr/bin/ --with-libdir=lib64 --with-zlib --with-gd --enable-shmop
--enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --enable-mbstring --with-iconv

SQL Pocket Guide (Paperback)

By (author): Jonathan Gennick


List Price: $14.99 USD
New From: $8.18 USD In Stock
Used from: $4.99 USD In Stock

MySQL High Availability: Tools for Building Robust Data Centers (Paperback)

By (author): Charles Bell, Mats Kindahl, Lars Thalmann


List Price: $49.99 USD
New From: $22.93 USD In Stock
Used from: $4.65 USD In Stock

Share