/opt/php/sbin/php-fpm: relocation error: /opt/php/sbin/php-fpm: symbol mysql_server_init, version libmysqlclient_18
not defined in file libmysqlclient.so.18 with link time reference
记录一下,没有找到解决办法。
欢迎留言。
1、如下不行:
自己一定要删除干净。
最近编译php的时候在加入mysql编译参数的时候报错,然后我就仔细的研究了下
基本情况:
系统:CentOS-6.5
数据库:之前yum安装了mysql后来卸载掉,编译安装了mysql
php:我电脑里装了两个版本的php
一个是yum安装的 php-5.4.28
另一个是编译安装的 php-5.3.28
以下是各种报错
1
2
3
4
5
|
[root@localhost php-5.3]# php-fpm
[09-Jun-2014 15:37:41] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/mysql.so'
- /usr/lib64/mysql/libmysqlclient.so.18: version `libmysqlclient_16' not found (required by /usr/lib64/php/modules/mysql.so) in Unknown on line 0
[09-Jun-2014 15:37:41] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/mysqli.so'
- /usr/lib64/mysql/libmysqlclient.so.18: version `libmysqlclient_16' not found (required by /usr/lib64/php/modules/mysqli.so) in Unknown on line 0
[09-Jun-2014 15:37:41] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/pdo_mysql.so'
- /usr/lib64/mysql/libmysqlclient.so.18: version `libmysqlclient_16' not found (required by /usr/lib64/php/modules/pdo_mysql.so) in Unknown on line 0
[root@localhost php-5.3]#
|
1
|
version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference
|
1
|
/usr/lib64/mysql/libmysqlclient.so.18: version `libmysqlclient_16' not found (required by /usr/lib64/php/modules/mysql.so) in Unknown on line 0
|
错误分析:
是64位系统中 libmysqlclient 默认安装到了 /usr/lib64/mysql/ 目录下
如果此目录没有加入到 /etc/ld.so.conf里面,Linux就无法自动加载 /usr/lib64/mysql/ 里面的库文件
php编译时要去 /usr/lib64 和 /etc/ld.so.conf 所指定的目录下查找,却找不到 libmysqlclient 文件
解决方法一:
1
|
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18(mysql是编译安装的使用此行) ln -s /usr/lib64/mysql/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18 (myslq非编译安装的使用此行)
|
解决方法二: 也可以把mysql库加入/etc/ld.so.conf.d里面
备注:
我两个php用的libmysqlclient版本不一样,我要经常切换
一个用 libmysqlclient.so.18.0.0
另一个 libmysqlclient.so.18.1.0