php 缺少扩展 mysqli,phpmyadmin 不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10769148/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Extension mysqli is missing, phpmyadmin doesn't work
提问by Jeremas
I have a problem with phpmyadmin on ubuntu 12.04. I have already installed apache2, php5, mysql and phpmyadmin.
我在 ubuntu 12.04 上的 phpmyadmin 有问题。我已经安装了 apache2、php5、mysql 和 phpmyadmin。
The phpinfo();script, don't show nothing about mysqli or mysql extension.
该phpinfo();脚本不显示任何有关 mysqli 或 mysql 扩展的信息。
When I try start phpmyadmin this error appear:
当我尝试启动 phpmyadmin 时出现此错误:
---- **phpMyAdmin - Error** ------- **The mysqli extension is missing. Please check your PHP configuration.** ----
In the php.ini file, I uncommented extension=mysql.soline, but doesn't work...
在 php.ini 文件中,我取消了注释extension=mysql.so行,但不起作用...
Anyone have another posible solution?
有人有其他可行的解决方案吗?
回答by c2h5oh
Latest phpMyAdmin versions require mysqli extension and will no longer work with mysql one (note the extra "i" at the end of its name).
最新的 phpMyAdmin 版本需要 mysqli 扩展并且将不再与 mysql 一起使用(注意其名称末尾的额外“i”)。
sudo apt-get install php5-mysql
Will install package containing both old one and the new one, so afterwards all you need to do is to add
将安装包含旧的和新的包,所以之后你需要做的就是添加
extension=mysqli.so
in your php.ini, restart apache and it should work.
在您的 php.ini 中,重新启动 apache,它应该可以工作。
回答by Hardik Gajjar
sudo apt-get install php5-mysql
sudo apt-get install php5-mysqlnd
try both of alternatively it works for me
尝试两种方法都对我有用
回答by Nilson Dimas
If you run PHPMyAdmin on localhost uncomment in file /etc/php5/apache2/php.inithis line:
如果您在本地主机上运行 PHPMyAdmin 取消注释文件中的/etc/php5/apache2/php.ini这一行:
mysqli.allow_local_infile = On
Restart Apache:
重启阿帕奇:
sudo /etc/init.d/apache2 restart
回答by dendi
Just restart the apache2 and mysql:
只需重新启动 apache2 和 mysql:
apache2:
sudo /etc/init.d/apache2 restartmysql:
sudo /etc/init.d/mysql restart
阿帕奇2:
sudo /etc/init.d/apache2 restartmysql:
sudo /etc/init.d/mysql restart
then refresh your browser, enjoy phpmyadmin :)
然后刷新浏览器,享受 phpmyadmin :)
回答by Maanit
I tried a lot of the answers and none of them seemed to work because php7.0 is not the default.
我尝试了很多答案,但它们似乎都不起作用,因为 php7.0 不是默认设置。
sudo apt-get upgrade
seemed to do the job for me but I had to reinstall php7.0 and phpmyadmin after that:
似乎为我完成了这项工作,但在那之后我不得不重新安装 php7.0 和 phpmyadmin:
sudo apt-get install php7.0 php7.0-mysql
sudo apt-get install apache2 apache2-mod-php7.0
sudo apt-get install phpmyadmin
Hope it helps!
希望能帮助到你!
回答by Gufran Hasan
I faced same issue and resolvedit by doing following steps:
我遇到了同样的问题并通过执行以下步骤解决了它:
First check PHP versions. If you have multiple PHP Versions. Suppose you have PHP versions like php7.0, php7.1 and php 7.2 then
run these commands
首先检查PHP版本。如果您有多个 PHP 版本。假设你有像 php7.0、php7.1 和 php 7.2 这样的 PHP 版本
运行这些命令
For PHP7.0
对于 PHP7.0
sudo apt-get install php7.0-mysql
sudo apt-get install php7.0-mysqlnd
For PHP7.1
对于 PHP7.1
sudo apt-get install php7.1-mysql
sudo apt-get install php7.1-mysqlnd
For PHP7.2
对于 PHP7.2
sudo apt-get install php7.2-mysql
sudo apt-get install php7.2-mysqlnd
Edit the ini file and look for mysqli. Uncomment the line by removing ;for all php versions
extension=mysqli.so
编辑 ini 文件并查找 mysqli。通过删除取消注释该行;适用于所有 php 版本
扩展名=mysqli.so
/etc/php/<php.version>/apache2/php.ini
/etc/php/<php.version>/apache2/php.ini
For PHp7.0
对于 PHP7.0
sudo nano /etc/php/7.0/apache2/php.ini
For PHp7.1
对于 PHP7.1
sudo nano /etc/php/7.1/apache2/php.ini
For PHp7.2
对于 PHP7.2
sudo nano /etc/php/7.2/apache2/php.ini
and last restart apache server
最后重启apache服务器
sudo /etc/init.d/apache2 restart
回答by Shimbawa
I solved this problem by editing /usr/local/zend/etc/php.ini.
我通过编辑 /usr/local/zend/etc/php.ini 解决了这个问题。
(found it by doing netstat -nlp | grep apache, then strace -p somepid | grep php.ini).
(通过执行 netstat -nlp | grep apache,然后 strace -p somepid | grep php.ini 找到它)。
At the end of the file, I added:
在文件的末尾,我添加了:
extension=/usr/lib/php5/20090626+lfs/mysql.so
extension=/usr/lib/php5/20090626+lfs/mysqli.so
extension=/usr/lib/php5/20090626+lfs/mcrypt.so
Adding it without the path did not work.
在没有路径的情况下添加它不起作用。
Then after a restart it worked.
然后重新启动后它工作了。
回答by kta
Checking the extension_dir is one of the thing you like to check from phpinfo().In my case it was extension_dir = "./" by default which was wrong. Change it to extension_dir = './ext/' or where all your extension dlls are currently residing.
检查 extension_dir 是您喜欢从 phpinfo() 检查的事情之一。在我的情况下,默认情况下它是 extension_dir = "./" ,这是错误的。将其更改为 extension_dir = './ext/' 或所有扩展 dll 当前所在的位置。
回答by MasterCassidy
You need the MySQLi module. This error usually occurs when manually installing phpMyAdmin.
您需要 MySQLi 模块。手动安装phpMyAdmin时通常会出现此错误。
sudo apt-get install php7.3-mysql
It will return you with.
它会回报你。
[Creating config file /etc/php/7.3/mods-available/mysqlnd.ini with new version]
[Creating config file /etc/php/7.3/mods-available/mysqli.ini with new version]
Then.
然后。
sudo service apache2 restart.
Then.
然后。
Press F5 on your browser.
回答by Rishi
For ubuntu user open your terminal and type following command
对于 ubuntu 用户,打开您的终端并输入以下命令
sudo apt-get install mysql
After that just restart apache2 by typing this
之后只需输入以下内容重新启动apache2
sudo service apache2 restart
refresh you browser and enjoy phhmyadmin
刷新您的浏览器并享受 phhmyadmin

