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.
- [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