在 CentOS 上使用 php 和 mysql 模块获取共享库错误

在 CentOS 上使用 php 和 mysql 模块获取共享库错误

我首先安装php5.5mysql5.6然后由于一些包问题,我不得不删除它们并从 yum 安装 php5.3 和 mysql 5.1。

我的 php 没有检测到任何扩展并给出此错误

[root@ipserver etc]# php -m
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.16: 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/mysqli.so' - libmysqlclient.so.16: 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' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
[PHP Modules]

我确实在该目录中有文件并且它们具有读取权限

[root@ipserver etc]# php --ini
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.16: 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/mysqli.so' - libmysqlclient.so.16: 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' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini,
/etc/php.d/pdo_mysql.ini

编辑:

我尝试仅将 mysql.so 文件复制到其他地方,并在 php.ini 中进行 harcode

extension=/etc/mysql.so

我明白了

PHP Warning:  PHP Startup: Unable to load dynamic library '/etc/mysql.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      (none)

答案1

跑步

 ldconfig

这使得动态链接器运行时绑定重新读取

/etc/ld.so.conf.d

新库目录的目录。

答案2

你缺少 MySQL客户libary,而不是 MySQL 库本身。错误抱怨的是:libmysqlclient.so.16

尝试安装该mysql-libs包。如果您已经安装了它,请尝试重新安装。libmysqlclient.so.16 似乎是其中的一部分

您从哪里获得安装失败的 MySQL 包?您可能需要清除一些配置文件,然后一切才能重新协同工作,因为较新版本的东西可能会覆盖较旧的配置,而重新安装较旧的包可能不会覆盖它们。

编辑:看到你将其标记为 CentOS 并删除了我的评论 :)

相关内容