php phpMyAdmin - 缺少 MySQL 扩展

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8225198/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 04:11:54  来源:igfitidea点击:

phpMyAdmin - The MySQL Extension is Missing

phpmysqlphpmyadmin

提问by Carpet

I installed everything separately (Apache, PHP, MySQL and phpMyAdmin) and do not use a compilation, everything works fine till now except phpMyAdmin.

我单独安装了所有东西(Apache、PHP、MySQL 和 phpMyAdmin)并且不使用编译,到目前为止一切正常,除了 phpMyAdmin。

The problem I am experiencing is, that the error message states that the "MySQL extension is missing", as soon as I try to call up:

我遇到的问题是,一旦我尝试调用,错误消息就会指出“缺少 MySQL 扩展”:

localhost/phpmyadmin/index.php

本地主机/phpmyadmin/index.php

And when I call up

当我打电话时

localhost/phpmyadmin/setup/index.php

本地主机/phpmyadmin/setup/index.php

I have two messages where I do not know if it is supposed to be like that:

我有两条消息,我不知道它是否应该是这样的:

Bzip2 compression and decompression requires functions (bzopen, bzcompress) which are unavailable on this system.

Bzip2 压缩和解压需要本系统不可用的功能(bzopen、bzcompress)。

and:

和:

Zip decompression requires functions (zip_open) which are unavailable on this system.

Zip 解压缩需要在此系统上不可用的功能 (zip_open)。

Any suggestions?

有什么建议?

回答by Alim Ul Gias

At first make sure you have mysql installed properly. You can ensure it just by checking that whether you can access mysql using mysql command promp. So if you mysql is working then probably it is not loading. For that follow the steps given below

首先确保你已经正确安装了mysql。您可以通过使用 mysql 命令提示符检查是否可以访问 mysql 来确保它。因此,如果您的 mysql 正在运行,那么它可能没有加载。为此,请按照下面给出的步骤

First of all, you must find your php.ini. It could be anywhere but if you create a small php file with the

首先,你必须找到你的php.ini。它可以在任何地方,但是如果您使用

<?php phpinfo(); ?>

script it will tell you where it is. Just look at the path of loaded configuration file. Common places include /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini for Windows it may be C:\Users\username\PHP\php.ini

脚本它会告诉你它在哪里。看看加载的配置文件的路径。常见的地方包括 /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini 甚至 /usr/local/lib/php.ini 对于 Windows 它可能是 C:\用户\用户名\PHP\php.ini

Edit your server's php.ini and look for the following line. Remove the ‘;' from the start of the line and restart Apache. Things should work fine now!

编辑服务器的 php.ini 并查找以下行。去除那个 ';' 从行的开始并重新启动 Apache。现在一切正常!

;extension=mysql.so

should become

应该成为

extension=mysql.so

For windows it will be

对于窗户,它将是

;extension=mysql.dll

should become

应该成为

extension=mysql.dll

回答by Hafez Divandari

Installing bzip2and zipPHP extensions solved my issue in Ubuntu:

安装bzip2zipPHP 扩展解决了我在 Ubuntu 中的问题:

sudo apt-get install php7.0-bz2
sudo apt-get install php7.0-zip

Use php(you version)-(extension)to install and enable any missing modules that is required in the phpmyadmin readme.

使用php(you version)-(extension)安装和启用任何在phpMyAdmin的自述缺少所需的模块。

回答by Ivan Buttinoni

Some linux distributions have a php_mysqland php_mysqlipackage to install.

一些 linux 发行版需要安装php_mysqlphp_mysqli包。

回答by Gavin Simpson

You need to put the full path in the php ini when loading the mysql dll, i.e :-

加载mysql dll时需要将完整路径放在php ini中,即:-

extension=c:/php54/ext/php_mbstring.dll
extension=c:/php54/ext/php_mysql.dll

扩展名=c:/php54/ext/php_mbstring.dll
扩展名=c:/php54/ext/php_mysql.dll

Then you don't need to move them to the windows folder.

然后你不需要将它们移动到 windows 文件夹。

回答by KalenGi

In my case I had to install the extension:

就我而言,我必须安装扩展程序:

yum install php php-mysql httpd

and then restart apache:

然后重启apache:

service httpd restart

That solved the problem.

那解决了问题。

回答by Ahmad Baktash Hayeri

Just as others stated you need to remove the ';' from:
;extension=php_mysql.dlland
;extension=php_mysqli.dll

正如其他人所说,您需要从以下位置删除“ ;”:
;extension=php_mysql.dll
;extension=php_mysqli.dll

in your php.ini to enable mysql and mysqli extensions. But MOST IMPORTANT of all, you should set the extension_dirin your php.ini to point to your extensions directory. The default most of the time is "ext". You should change it to the absolutepath to the extensions folder. i.e. if you have your xampp installed on drive C, then C:/xampp/php/extis the absolute path to the ext folder, and It should work like a charm!

在你的 php.ini 中启用 mysql 和 mysqli 扩展。但最重要的是,您应该将extension_dirphp.ini 中的设置为指向您的扩展目录。大多数时候的默认值是“ ext”。您应该将其更改为扩展文件夹的绝对路径。即,如果您的 xampp 安装在驱动器 C 上,则 C:/xampp/php/ext是 ext 文件夹的绝对路径,它应该像魅力一样工作!

回答by Alez Dakidd

I just add

我只是添加

apt-get install php5-mysqlnd

This will ask to overwrite mysql.so from "php5-mysql".

这将要求从“php5-mysql”覆盖 mysql.so。

This work for me.

这对我有用。

回答by Stephan B

Your installation is missing some php modules, there should be a list of required modules in the phpmyadmin readme. If you recently enabled the modules, try restarting the apache service / daemon.

您的安装缺少一些 php 模块,phpmyadmin 自述文件中应该有所需模块的列表。如果您最近启用了这些模块,请尝试重新启动 apache 服务/守护程序。

Edit: As it seems, there is no single "enable these modules" in the docs, so enable either mysqlor mysqliin your php.ini (you might need to install it first).

编辑:看起来,文档中没有单一的“启用这些模块”,所以在你的 php.ini 中启用mysql或启用mysqli(你可能需要先安装它)。

The two messages are not important if you do not intend to upload or download compressed file within phpMyAdmin. If you do, enable the zliband / or bz2modules.

如果您不打算在 phpMyAdmin 中上传或下载压缩文件,那么这两条消息并不重要。如果这样做,请启用zlib和/或bz2模块。

回答by Dagligleder

I had a similar issue, but it didn't help to add extension=mysql.so in my php.ini. It turned out that the mysql.so file was not in my extension folder nor anywhere else on my machine. Solved this by downloading the php source and building the extension manually and then copying it into the extension folder.

我有一个类似的问题,但是在我的 php.ini 中添加 extension=mysql.so 没有帮助。结果是 mysql.so 文件不在我的扩展文件夹中,也不在我机器上的任何其他地方。通过下载 php 源代码并手动构建扩展然后将其复制到扩展文件夹中来解决此问题。

回答by user1058988

Just check your php.ini file, In this file Semicolon(;) used for comment if you see then remove semicolon ;.

只需检查您的 php.ini 文件,在此文件中,分号 (;) 用于评论,如果您看到然后删除分号 ;。

;extension=mysql.dll

Now your extension is enable but you need to restart appache

现在您的扩展已启用,但您需要重新启动 appache

extension=mysql.dll