简体   繁体   中英

PHP: error while loading shared libraries: libmysqlclient.so.18

I'm Set Crontab :

[root@root mysql]# crontab -l
5 *  *  *  *  php /home/admin/public_html/scheduleSendMail.php

But Not Execute PHP code!

[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

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)

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

Thanks All

Php is compiled against the wrong mysql lib.

I suggest you to check if the php executable is the one provided with the rpm package.

You can also try a dirty workaround, go to the directory where the libmysqlclient.so.16 is located and write:

ln -s libmysqlclient.so.16 libmysqlclient.so.18

A better option is remove your php and install the version 5.3.23:

  1. yum remove php
  2. wget http://repo.webtatic.com/yum/centos/5/latest.rpm
  3. rpm -ivh latest.rpm
  4. enable the webtatic repository and disable the rhea repository (/etc/yum.repos.d/)
  5. yum install php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM