gpt4 book ai didi

PHP7 给出错误 "PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so'

转载 作者:行者123 更新时间:2023-12-03 23:05:46 26 4
gpt4 key购买 nike

在一台新服务器上,我安装了 PHP 7.0.10 和 mysql。当我尝试使用 mysqli_connect() 通过 php 文件连接到数据库时,它给出了错误消息

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /opt/http/blabla/src/class_db.php:19 Stack trace: #0 /opt/http/blabla/src/main.php(17): _Db->connect() #1 {main} thrown in /opt/http/blabla/src/class_db.php on line 19

这是因为PHP无法加载mysql共享对象造成的:

[root@nl2 httpd]# php -v PHP Warning: PHP Startup: Unable to load dynamic library '/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 in Unknown on line 0 PHP 7.0.11 (cli) (built: Sep 17 2016 09:23:18) ( NTS )

两个库都存在:

[root@nl2 httpd]# ls -l /usr/lib64/php/modules/mysqli.so /usr/lib64/php/modules/mysqli.so
-rwxr-xr-x 1 root root 141856 Sep 17 11:39 /usr/lib64/php/modules/mysqli.so
-rwxr-xr-x 1 root root 141856 Sep 17 11:39 /usr/lib64/php/modules/mysqli.so

一些配置信息:

# yum list installed
php70w.x86_64 7.0.10-1.w7
php70w-cli.x86_64 7.0.10-1.w7
php70w-common.x86_64 7.0.10-1.w7
php70w-devel.x86_64 7.0.10-1.w7
php70w-gd.x86_64 7.0.10-1.w7
php70w-mysql.x86_64 7.0.10-1.w7
php70w-opcache.x86_64 7.0.10-1.w7
php70w-pdo.x86_64 7.0.10-1.w7
php70w-process.x86_64 7.0.10-1.w7
mysql55w.x86_64 5.5.50-1.w
mysql55w-devel.x86_64 5.5.50-1.w
mysql55w-libs.x86_64 5.5.50-1.w
mysql55w-server.x86_64 5.5.50-1.w

# cat /etc/php.d/mysqli.ini
;Enable mysqli extension module
extension=mysqli.so
extension=php_mysqli.so

有什么建议吗?谢谢。

最佳答案

我想发表评论,但我没有足够的积分。你试过吗:

yum -y install php70w-mbstring php70w-mcrypt

然后连接使用:

$mysqli = new mysqli('ip', 'user', 'pass', 'db', port);

我觉得是PHP安装不够的问题!

关于PHP7 给出错误 "PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39621896/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com