PHP:加载共享库时出错:libmysqlclient.so.18
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13994089/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP: error while loading shared libraries: libmysqlclient.so.18
提问by Ali ZahediGol
I'm Set Crontab :
我设置了 Crontab :
[root@root mysql]# crontab -l
5 * * * * php /home/admin/public_html/scheduleSendMail.php
But Not Execute PHP code!
但不执行 PHP 代码!
[root@root mysql]# php /home/admin/public_html/scheduleSendMail.php
php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
[root@root mysql]# rpm -qR postfix
find :
找 :
..
libmysqlclient.so.16
libmysqlclient.so.16(libmysqlclient_16)
..
I am using the Centos And DirectAdmin
我正在使用 Centos 和 DirectAdmin
PHP v: php-5.3.3-14.el6_3.i686
mysql v: mysql-5.1.66-2.el6_3.i686
centos v: CentOS release 6.3 (Final)
回答by Ali ZahediGol
code:
代码:
#ls -l /usr/lib/mysql | grep libmysqlclient.so
outPut:
输出:
lrwxrwxrwx 1 root root 24 Dec 21 21:41 libmysqlclient.so -> libmysqlclient.so.16.0.0
lrwxrwxrwx 1 root root 24 Dec 21 21:41 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
-rwxr-xr-x 1 root root 1524000 Dec 7 18:27 libmysqlclient.so.16.0.0
#ln /usr/lib/mysql/libmysqlclient.so.16.0.0 /usr/lib/mysql/libmysqlclient.so.18
Not Work !
不行 !
But :
但 :
#ln /usr/lib/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so.18
It's Work very Good :D
它的工作非常好:D
Thanks All
谢谢大家
回答by Kbyte
Php is compiled against the wrong mysql lib.
PHP 是针对错误的 mysql 库编译的。
I suggest you to check if the php executable is the one provided with the rpm package.
我建议您检查 php 可执行文件是否是随 rpm 包提供的可执行文件。
You can also try a dirty workaround, go to the directory where the libmysqlclient.so.16 is located and write:
您也可以尝试一个肮脏的解决方法,转到 libmysqlclient.so.16 所在的目录并写入:
ln -s libmysqlclient.so.16 libmysqlclient.so.18
ln -s libmysqlclient.so.16 libmysqlclient.so.18
回答by Ivan
A better option is remove your php and install the version 5.3.23:
更好的选择是删除您的 php 并安装 5.3.23 版本:
- yum remove php
- wget http://repo.webtatic.com/yum/centos/5/latest.rpm
- rpm -ivh latest.rpm
- enable the webtatic repository and disable the rhea repository (/etc/yum.repos.d/)
- yum install php
- yum 删除 php
- wget http://repo.webtatic.com/yum/centos/5/latest.rpm
- rpm -ivh 最新.rpm
- 启用 webtatic 存储库并禁用 rha 存储库 (/etc/yum.repos.d/)
- yum 安装 php

