[英]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.