Recently I was configuring PHP with Mysql manually and it was really annoying to see the “Cannot find libmysqlclient under /usr” error message. The configure line I used to install PHP was
./configure --with-mysql --with-libdir=/usr/lib
and the error that I received was
checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock configure: error: Cannot find libmysqlclient under /usr. Note that the MySQL client library is not bundled anymore!
The error occurred because libmysqlclient wasn’t present in the /usr/lib directory. On further investigation, I noticed the libmysqlclient is installed in the /usr/lib64 directory because the server is a 64bit machine.
So the fix for the “mysql: Cannot find libmysqlclient under /usr” error message is to provide lib64 directory path in the configure line.
The configure line should read as follows:
./configure --with-mysql --with-libdir=lib64
That’s it.
This entry was posted
on Monday, September 3rd, 2012 and is filed under Linux Administration.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.
Материал из Wiki — Iphoster — the best ever hosting and support. 2005 — 2023
Перейти к:навигация, поиск
CentOS php — configure: error: Cannot find libmysqlclient under /usr.
Ошибка при компиляции php:
checking for mcrypt support... yes checking for libmcrypt version... >= 2.5.6 checking for mcrypt_module_open in -lmcrypt... yes checking for MSSQL support via FreeTDS... no checking for MySQL support... yes checking for specified location of the MySQL UNIX socket... no configure: error: Cannot find libmysqlclient under /usr. Note that the MySQL client library is not bundled anymore!
Проверяем где находятся библиотеки mysql:
# ldconfig -v |grep mysql libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0 libmysqlclient.so.18 -> libmysqlclient_r.so.18.0.0 libmysqlclient.so.15 -> libmysqlclient.so.15.0.0 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0 libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0 # locate libmysqlclient.so.16 /usr/lib64/libmysqlclient.so.16 /usr/lib64/libmysqlclient.so.16.0.0 /usr/local/cpanel/3rdparty/lib64/mysql/libmysqlclient.so.16 /usr/local/cpanel/3rdparty/lib64/mysql/libmysqlclient.so.16.0.0
Решение — добавляем опцию —with-libdir=lib64:
# ./configure --prefix=/opt/php53 --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-libdir=lib64 --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --enable-ftp --with-imap-ssl --with-kerberos --with-gettext --enable-cgi
Комментарии
Recently I was configuring PHP with Mysql manually and it was really annoying to see the “Cannot find libmysqlclient under /usr” error message. The configure line I used to install PHP was
./configure --with-mysql --with-libdir=/usr/lib
and the error that I received was
checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock configure: error: Cannot find libmysqlclient under /usr. Note that the MySQL client library is not bundled anymore!
The error occurred because libmysqlclient wasn’t present in the /usr/lib directory. On further investigation, I noticed the libmysqlclient is installed in the /usr/lib64directory because the server is a 64bit machine.
So the fix for the “mysql: Cannot find libmysqlclient under /usr” error message is toprovide lib64 directory path in the configure line.
The configure line should read as follows:
./configure --with-mysql --with-libdir=lib64
That’s it.
- Posted by in Linux
- Tagged: lib directory, mysql client, unix socket
I was trying to build
PHP 5.2.17
from source onUbuntu 12.4 64bit
using this configuration:./configure --prefix=/opt/php5.2 --with-config-file-path=/opt/php5.2 --with-mysql
but I keep getting this error:
configure: error: Cannot find libmysqlclient under /usr. Note that the MySQL client library is not bundled anymore!
Any Idea how to resolve this?
EDIT1: I minimized the configure command so it just focuses to mysql. also I’m running a 64bit version of ubuntu.
EDIT2: tried running
ldconfig -v |grep mysql
and here is the output# ldconfig -v |grep mysql /sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once /sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once /sbin/ldconfig.real: Cannot stat /usr/lib/x86_64-linux-gnu/libnss_db.so: No such file or directory libmysqlclient.so.18 -> libmysqlclient_r.so.18.0.0 libmysqlpp.so.3 -> libmysqlpp.so.3.1.0
Answer
Thanx @hakre for the assistance.
here is the command I used and it works:
sudo ./configure --prefix=/opt/php5.2 --with-config-file-path=/opt/php5.2 --with-mysql --with-libdir=/lib/x86_64-linux-gnu
Attribution
Source : Link , Question Author : farzam , Answer Author : farzam
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Fix:-
#yum install libmcrypt libmcrypt-devel
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
Fix:-
#yum install libxslt-devel
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!
Fix:-
#ln -s /usr/lib64/libmysqlclient.so /usr/lib/libmysqlclient.so
#ln -s /usr/lib64/libmysqlclient.so /usr/local/libmysqlclient.so
gcc: /usr/lib/mysql/libmysqlclient.so: No such file or directory
Fix:-
#ln -s /usr/lib64/libmysqlclient.so /usr/lib64/mysql/libmysqlclient.so
checking for BZip2 in default path… not found
configure: error: Please reinstall the BZip2 distribution
Fix:
#yum install bzip2-devel
checking for cURL in default path… not found
configure: error: Please reinstall the libcurl distribution –
easy.h should be in <curl-dir>/include/curl/
Fix:
yum install curl-devel
checking for png_write_image in -lpng… yes
If configure fails try –with-xpm-dir=<DIR>
configure: error: freetype.h not found.
Fix:
Reconfigure your PHP with the option.
–with-xpm-dir=/usr
checking for jpeg_read_header in -ljpeg… yes
configure: error: png.h not found.
Fix:
yum install libpng-devel
configure: error: Unable to locate gmp.h
Fix:
yum install gmp-devel
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
Fix:
yum install libc-client-devel
checking for pg_config… not found
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
Fix:
yum install postgresql-devel
checking for sqlite3 files in default path… not found
configure: error: Please reinstall the sqlite3 distribution
Fix:
yum install sqlite-devel
checking for PCRE headers location… configure: error: Could not find pcre.h in /usr
Fix:
yum install pcre-devel
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
Fix:
yum install libxslt-devel
configure: error: SNMP sanity check failed. Please check config.log for more information.
Fix:
yum install net-snmp-devel
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
FiX:
yum install libicu-devel
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
Fix:
yum install postgresql-devel
checking for location of ICU headers and libraries… not found
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
fix install package libicu and libicu-devel.
configure: error: Please reinstall the BZip2 distribution
Fehlende Bibliothek: libbz2
1
apt-get install libbz2-dev
configure: error: Please reinstall the libcurl distribution – easy.h should be in <curl-dir>/include/curl/
Fehlende Bibliothek: libcurl
1
apt-get install libcurl3-dev
Debian Lenny:
1
libcurl4-openssl-dev
configure: error: Cannot find MySQL header files under yes.
Fehlende Bibliothek: libmysql
1
apt-get install libmysqlclient15-dev
configure: error: DBA: Could not find necessary header file(s)
Fehlende Bibliothek: libgdbm
1
apt-get install libgdbm-dev
configure: error: libjpeg.(a|so) not found
Fehlende Bibliothek: libjpeg
1
apt-get install libjpeg62 libjpeg62-dev
configure: error: libpng.(a|so) not found
Fehlende Bibliothek: libpng
1
apt-get install libpng12-0 libpng12-dev
configure: error: xml2-config not found. Please check your libxml2 installation.
Fehlende Bibliothek: libxml2
1
apt-get install libxml2 libxml2-dev
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Fehlende Bibliothek: libmcrypt
1
apt-get install libmcrypt4 libmcrypt-dev
configure: error: Please reinstall libmhash – I cannot find mhash.h
Fehlende Bibliothek: libmhash
1
apt-get install libmhash2 libmhash-dev
configure: error: Please reinstall readline – I cannot find readline.h
Fehlende Bibliothek: libreadline
1
apt-get install libreadline5-dev
configure: error: cannot find mm library
Fehlende Bibliothek: libmm
1
apt-get install libmm-dev libmm14
configure: error: Cannot find libtidy
Fehlende Bibliothek: libtidy
1
apt-get install libtidy-dev libtidy-0.99-0
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
Fehlende Bibliothek: libxslt
1
apt-get install libxslt1-dev libxslt1.1
1) Configure: error: xml2-config not found. Please check your libxml2 installation.
Solutions :
#yum install libxml2-devel
2) Checking for pkg-config… /usr/bin/pkg-config
configure: error: Cannot find OpenSSL’s <evp.h>
Solutions :
#yum install openssl-devel
3) Configure: error: Please reinstall the BZip2 distribution
Solutions :
# yum install bzip2-devel
4) Configure: error: Please reinstall the libcurl distribution –
easy.h should be in <curl-dir>/include/curl/
Solutions :
# yum install curl-devel
5) Configure: error: libjpeg.(also) not found.
Solutions :
# yum install libjpeg-devel
6) Configure: error: libpng.(also) not found.
Solutions :
# yum install libpng-devel
7) Configure: error: freetype.h not found.
Solutions :
#yum install freetype-devel
Configure: error: Unable to locate gmp.h
Solutions :
# yum install gmp-devel
9) Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
Solutions :
# yum install mysql-devel
10) Configure: error: Please reinstall the ncurses distribution
Solutions :
# yum install ncurses-devel
11) Checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!
Solutions :
# yum install unixODBC-devel
12) Configure: error: Cannot find pspell
Solutions :
# yum install pspell-devel
13) Configure: error: snmp.h not found. Check your SNMP installation.
Solutions :
# yum install net-snmp-devel
If you have any doubts or face any errors, please feel free to approach me with your queries..
Last edited by AlexP; 02-10-2008 at 23:14. Reason: typo
-
September 10 2008, 20:12
- IT
- Cancel
Да, это секс, детка. Это настоящий секс с макосью, когда ты хочешь откомпилировать модуль mysql для php, но ./configure
выдаёт тебе это самое сообщение. Я отдаю себе отчёт ,что это скорее всего из-за того, что мускул поставлен из макпортов. На самом деле, конечно, потому, что некоторые конфигуры пытаются определить путь к мускулу из строки configure для php, которая у меня выгялдит вот так — ./configure' '--enable-fastcgi' '--enable-fpm
. Да, nginx + php-fpm, спасибо ещё трём часам неописуемого секса. А сколько его было до того…
Описания решения, по крайней мере для макоси, я не нашёл. Но на этот раз сильно разозлило, и я решил побороться.
Для начало пришлось найти в configure строчки, которые отвечают за вывод этого сообщения.
Сообщение это выводится, как ни странно, на 4001 строке. Чуть выше видно, где скрипт пытается найти хидеры мускула — это $PHP_MYSQL
, /usr/local
и /usr
. На первый я забил, а второй решил использовать. Но для этого нужно найти mysql.h
, что очень просто делается с помощью locate mysql.h. Нашёлся засранец в /opt/local/include/mysql5/mysql/
(/opt
— это от портов бывает). Соответственно, делаем sudo ln -s /opt/local/include/mysql5/mysql/ /usr/local/include/mysql
.
Уличная магия! Теперь мы видим configure: error: Cannot find libmysqlclient under /usr/local. Это уже проще. Товарищ сообщает нам, что хотел бы видеть также и библиотеки от мускула. Нет ничего проще, особенно после того, как нашёл эти библиотеки (locate libmysqlclient
). Вуаля: sudo ln -s /opt/local/lib/mysql5/mysql/* /usr/local/lib/
. Пробуем снова — работает!
После этого были make
и make install
. Но ничего уже не сравнится с тем кульминационным моментом, когда ./configure заработало.
Так, помаленьку, люди и превращаются в извращенцев.