Solution of configure error Cannot find libmysqlclient under usr when compiling PHP
- 2021-07-02 23:48:48
- OfStack
There was an error compiling PHP 5.2. 6 on 64-bit Red Hat Enterprise Linux AS release 4.7 today, mysql was installed using RPM, and PHP was compiled as follows:
./configure --prefix=/usr/local/php --with-mysql --with-apxs2=/usr/local/apache/bin/apxs --with-openssl --with-curl --enable-xml --with-mcrypt --with-ttf --enable-magic-quotes --enable-fastcgi --enable-mbstring --with-iconv --enable-mbstring --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --enable-sysvsem The following error occurred :checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!
By looking for libmysqlclient, it was found that the soft connection was made in libmysqlclient. so. 16. 0.0 in the/usr/lib64/mysql/directory, and PHP was searched the/usr/lib/by default, so it was not found. If the problem is found, it will be solved.
Similar problems include:
/usr/lib/libjpeg.so -> /usr/lib64/libjpeg.so
Solution:
1.
cp -rp /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so
2.
/usr/lib64/libmysqlclient.so -> libmysqlclient.so.16.0.0/usr/lib/libmysqlclient.so -> /usr/lib64/libmysqlclient.so
checking whether to enable embedded MySQLi support … no
checking for mysql_set_server_option in -lmysqlclient … no
configure: error: wrong mysql library version or lib not found. Check config.log for more information
After testing, the following solutions were found:
(php-xxxxx is the file name of php, representing the path)
# cd /usr/local/src/php-xxxxx/ext/mysqli
# yum -y install mysql-devel
# /phpize
# ./configure In fact, in fact, the with-php-config= /php-config In fact, in fact, the enable-embedded-mysqli=shared In fact, in fact, the enable-shared
# make
# make install
The screen will print the path generated by mysqli. so, just load it in php. ini
/usr/bin/ld: cannot find -lmysqlclient