version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference

在运行php -m时报错:

PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli.so' (tried: /usr/lib64/php/modules/mysqli.so (/usr/lib64/php/modules/mysqli.so: symbol mysql_change_user, version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference), /usr/lib64/php/modules/mysqli.so.so (/usr/lib64/php/modules/mysqli.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysql.so' (tried: /usr/lib64/php/modules/pdo_mysql.so (/usr/lib64/php/modules/pdo_mysql.so: symbol mysql_options, version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference), /usr/lib64/php/modules//usr/lib64/php/modules/pdo_mysql.so.so (/usr/lib64/php/modules//usr/lib64/php/modules/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli.so' (tried: /usr/lib64/php/modules/mysqli.so (/usr/lib64/php/modules/mysqli.so: symbol mysql_change_user, version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference), /usr/lib64/php/modules/mysqli.so.so (/usr/lib64/php/modules/mysqli.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib64/php/modules/pdo_mysql.so (/usr/lib64/php/modules/pdo_mysql.so: symbol mysql_options, version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference), /usr/lib64/php/modules/pdo_mysql.so.so (/usr/lib64/php/modules/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

看起来有一大堆东西。实际上这几个都有一个共同的一句话,那就是上面标红的那部分

其实这是因为libmysqlclient.so.18这个文件冲突了,我们可以看一下:


[root@VM_0_9_centos ~]# find / -name "libmysqlclient.so.18"
/home/mysql/lib/libmysqlclient.so.18
/usr/lib64/libmysqlclient.so.18

我们发现实际上已经存在两个这玩意,这肯定会冲突,而且php肯定是使用第二个,然而第二个并不行,我们需要的是mysql带的lib,因此,我们直接将第二个干掉,然后增加一个软链即可:

[root@VM_0_9_centos ~]# ln -s /home/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
ln: failed to create symbolic link ‘/usr/lib64/libmysqlclient.so.18’: File exists
[root@VM_0_9_centos ~]# rm -rf /usr/lib64/libmysqlclient.so.18
[root@VM_0_9_centos ~]# ln -s /home/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

然后再次运行php -m就不会出错了

发布了327 篇原创文章 · 获赞 56 · 访问量 28万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览