Php - 您的 PHP 安装似乎缺少 WordPress 所需的 MySQL 扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17694568/
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
Php - Your PHP installation appears to be missing the MySQL extension which is required by WordPress
提问by Roald Van Der Tempel
How do I fix the error below?
我如何修复下面的错误?
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
您的 PHP 安装似乎缺少 WordPress 所需的 MySQL 扩展。
I use my NAS with a telnet connection.
我通过 telnet 连接使用我的 NAS。
I installed FFP 0.7
我安装了 FFP 0.7
My php.ini
is in: ffp/etc/php.ini
and I uncommented everything I thought to be of use.
My php.ini
is in:ffp/etc/php.ini
并且我取消了我认为有用的所有内容的注释。
Below is a portion of my php.ini
file;
以下是我的php.ini
文件的一部分;
;If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
extension=msql.dll
;
; ... or under UNIX:
;
extension=msql.so
;
; ... or with a path:
;
extension=/ffp/lib/extensions/no-debug-non-zts-20100525/mysql.so
;
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so
The outstanding issue is that when I run in phpinfo()
, I see the module MySQLi activated but not MySQL.
悬而未决的问题是,当我运行 in 时phpinfo()
,我看到模块 MySQLi 已激活但未激活 MySQL。
MySQL is working as expected just as PHP and Lighttpd web server.
MySQL 与 PHP 和 Lighttpd Web 服务器一样按预期工作。
I equally have phpmyadmin working.
我同样有 phpmyadmin 工作。
It's on a Zyxel NSA310.
它位于 Zyxel NSA310 上。
Also, when mysqld
is started, it creates a shortcut from my root to: ffp/opt/mysql..
and every time I restart my NAS the shortcut is deleted.
此外,当mysqld
启动时,它会创建一个从我的根目录到:的快捷方式ffp/opt/mysql..
,每次我重新启动我的 NAS 时,快捷方式都会被删除。
Does anyone might know a trick for this?
有没有人可能知道这个技巧?
采纳答案by gview
The php mysql api is deprecated. It's kaput --- going away -- not to be used, finito.
不推荐使用 php mysql api。它是 kaput --- 消失了 - 不能使用,finito。
If you have a modern version of PHP (> 5.6) then Wordpress should automatically switch to make use of mysqli. That should be your first attempt.
如果您有 PHP 的现代版本(> 5.6),那么 Wordpress 应该会自动切换到使用 mysqli。那应该是你的第一次尝试。
If you can not update your php, rather than attempting to resurrect something that php no longer supports, just patch your wordpress: http://wordpress.org/plugins/mysqli/
如果你不能更新你的 php,而不是试图复活一些 php 不再支持的东西,只需修补你的 wordpress:http: //wordpress.org/plugins/mysqli/
回答by marcboffin
in the end i found a solution First, make sure MySQL server is running. Type the following command at a shell prompt:
最后我找到了一个解决方案首先,确保 MySQL 服务器正在运行。在 shell 提示符下键入以下命令:
/etc/init.d/mysql status
/etc/init.d/mysql status
If MySQL is not running, enter:
如果 MySQL 未运行,请输入:
/etc/init.d/mysql start
/etc/init.d/mysql start
If MySQL is not installed, type the following command to install MySQL server:
如果没有安装 MySQL,输入以下命令安装 MySQL 服务器:
apt-get install mysql-server
apt-get install mysql-server
Make sure MySQL module for php5 is installed:
确保安装了用于 php5 的 MySQL 模块:
dpkg --list | grep php5-mysql
dpkg --list | grep php5-mysql
To install php5-mysql module enter:
要安装 php5-mysql 模块,请输入:
apt-get install php5-mysql
apt-get install php5-mysql
Next, restart the Apache2 web server:
接下来,重新启动 Apache2 Web 服务器:
/etc/init.d/apache2 restart
/etc/init.d/apache2 restart
回答by ashishyadaveee11
This MySQL library worked for me:
这个 MySQL 库对我有用:
sudo apt-get install php5-mysqlnd-ms
回答by pravchuk
Check the
检查
extension_dir =
remove it if it is there. that should fix the problem.
如果它在那里,请将其删除。这应该可以解决问题。
回答by zedmelon
After nearly seven years this keeps getting different answers.? Many are similar--but none identical--to what worked for me. Here's what worked for me(Ubuntu server).
近七年后,这不断得到不同的答案。?许多与对我有用的相似 - 但不完全相同。 这是对我有用的(Ubuntu 服务器)。
Moving a site to a new server, forgot to install the PHP MySQL module/extension. I ran a quick
将站点移动到新服务器,忘记安装 PHP MySQL 模块/扩展。我跑得很快
apt-get install php-mysql
and then
进而
apachectl restart
Bada bing. No php5, php7; just plain php-mysql
.
八达冰。没有php5、php7;只是简单php-mysql
。
回答by subhash Porje
If people are using shared Linux hosting with cPanel (Godaddy, Reseller club, Hostgator or any Shared Hosting), try the following:
如果人们使用 cPanel 共享 Linux 主机(Godaddy、经销商俱乐部、Hostgator 或任何共享主机),请尝试以下操作:
Under Software and Services tab -> Select PHP Version -> PHP Selectors | Extentions
在软件和服务选项卡下 -> 选择 PHP 版本 -> PHP 选择器 | 扩展
Tick all MySQL related extensions, save it and you are done. Please check the attached image.
勾选所有与 MySQL 相关的扩展,保存即可。请检查附加的图像。
回答by amine
When you upgarde your php version, make sure, apache2 follows. You can create a phpinfo() file which could show that apache is still using the old php version.
当您升级 php 版本时,请确保 apache2 跟随。您可以创建一个 phpinfo() 文件,该文件可以显示 apache 仍在使用旧的 php 版本。
In this case you should use the a2dismod php-old-version and a2enmon php-mod-version commands
在这种情况下,您应该使用 a2dismod php-old-version 和 a2enmon php-mod-version 命令
Exemple :
例子:
in ubuntu, your grab the old version from /etc/apache2/mods-enabled, or from the version shown by the phpinfo file, and you grab the new one from /etc/apache2/mods-available
在 ubuntu 中,您从 /etc/apache2/mods-enabled 或 phpinfo 文件显示的版本中获取旧版本,然后从 /etc/apache2/mods-available 获取新版本
> sudo a2dismod php5.6
> sudo a2enmod php7.1
> sudo service apache2 restart
回答by Reza Mamun
This Error is created by the WP core file /wp-includes/load.phpand the function name is wp_check_php_mysql_versions()
.
此错误由 WP 核心文件/wp-includes/load.php创建,函数名称为wp_check_php_mysql_versions()
.
The older versions of the WP does not support MySqli. But the latest WP versions support both MySql and MySqli extensions without bothering installed PHP versions.
旧版本的 WP 不支持 MySqli。但是最新的 WP 版本同时支持 MySql 和 MySqli 扩展,而不会影响已安装的 PHP 版本。
Solved my problem 100%
100% 解决了我的问题
In my case, I just updated the Wordpress core files manuallyand solved the issue :)
就我而言,我只是手动更新了 Wordpress 核心文件并解决了问题:)
回答by Ng Zhong Qin
I'm using Fedora 25
我正在使用 Fedora 25
sudo dnf search php | grep mysql
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php-pear-MDB2-Driver-mysqli.noarch : MySQL Improved MDB2 driver mysqli
sudo dnf install php-mysqlnd.x86_64
回答by Raj008
It maybe the reason The php mysql api is deprecated. if your using below < PHP5.5 just update in your server to 5.6 and above.
这可能是不推荐使用 php mysql api 的原因。如果您使用低于 PHP5.5,只需将您的服务器更新到 5.6 及以上。