简体   繁体   English

Ubuntu PHP致命错误:调用PHP脚本时,调用in ..中未定义的函数mysqli_connect()

[英]Ubuntu PHP Fatal error: Call to undefined function mysqli_connect() in.. when calling PHP script

I run Ubuntu desktop 14.04 LTS (Trusty Tahr), and I am trying to setup Apache 2, MySQL server and PHP, but I keep gettin the following error: 我运行Ubuntu桌面14.04 LTS(Trusty Tahr),并且尝试设置Apache 2,MySQL服务器和PHP,但我仍然遇到以下错误:

PHP Fatal error: Call to undefined function mysqli_connect() in.. PHP致命错误:调用未定义函数mysqli_connect()。

What I have done is these changes in the correct php.ini: 我所做的是正确的php.ini中的这些更改:

uncomment: 取消评论:

extension=msqli.so 扩展名= msqli.so

set path aquired from phpinfo(): 设置从phpinfo()获取的路径:

extension_dir = "./usr/lib/php5/20121212+lfs" extension_dir =“ ./usr/lib/php5/20121212+lfs”

Why is the mysqli function to connect to the database still undefined? 为什么连接数据库的mysqli函数仍未定义?

In my case php5-mysql was missing from my Ubuntu server. 在我的情况下,我的Ubuntu服务器中缺少php5-mysql。 After installing the package it is working fine with mysqli adapter. 安装软件包后,它可以与mysqli适配器正常工作。

sudo apt-get install php5-mysql

It resolved my CodeIgniter 3.0 mysqli connection valid. 它解决了我的CodeIgniter 3.0 mysqli连接有效的问题。

running updates is usually recommended 通常建议运行更新

sudo apt-get update

then install needed version 然后安装所需的版本

sudo apt-get install php5-mysql
sudo apt-get install php7.0-mysql
sudo apt-get install php7.1-mysql
sudo apt-get install php7.2-mysql

restart apache 重新启动Apache

sudo service apache2 restart

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Linux PHP致命错误:调用未定义的函数mysqli_connect() - Linux PHP Fatal error: Call to undefined function mysqli_connect() Eclipse:“ PHP致命错误:调用未定义函数mysqli_connect()” - Eclipse: “PHP Fatal error: Call to undefined function mysqli_connect()” 致命错误:未捕获的错误:调用 php7 的 windows 中未定义的 function mysqli_connect() - Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in windows for php7 致命错误:在将PHP 5.4.22和MySQL 5.5与Apache 2.4.7连接时,调用未定义的函数mysqli_connect() - Fatal error: Call to undefined function mysqli_connect() in… while connecting PHP 5.4.22 and MySQL 5.5 with Apache 2.4.7 PHP错误:“调用未定义的函数mysqli_connect()” - PHP Error: “Call to undefined function mysqli_connect()” 致命错误:未捕获错误:调用未定义函数mysqli_connect() - Fatal error: Uncaught Error: Call to undefined function mysqli_connect() 获取错误致命错误:调用未定义函数mysqli_connect() - Getting an error Fatal error: Call to undefined function mysqli_connect() 致命错误:调用未定义的函数 mysqli_connect - Fatal error: Call to undefined function mysqli_connect 致命错误:调用未定义的函数 mysqli_connect() - Fatal error: Call to undefined function mysqli_connect() 致命错误:调用未定义的 function mysqli_connect() - Fatal error: Call to undefined function mysqli_connect()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM