我已经上传了备份到一个表,打开表我看到这个:

Warning in ./libraries/sql.lib.php#601
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/sql.lib.php#2038: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#1984: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'alternativegirls',
string 'tgp_photo',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `tgp_photo`',
NULL,
NULL,
)
./sql.php#216: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'alternativegirls',
string 'tgp_photo',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `tgp_photo`',
NULL,
NULL,
)
./index.php#53: include(./sql.php)

在phpMyAdmin……

PHP是7.2,服务器是Ubuntu 16.04,昨天安装的。

我看到一些人在他们的代码中有这个错误,但我没有发现任何人在phpMyAdmin中收到它…

我该怎么办?这是我的错误吗?phpmyadmin错误?等待更新?回到PHP 7.1?


当前回答

add-apt-repository ppa:phpmyadmin/ppa
apt-get clean
apt-get update
apt-get purge phpmyadmin
apt-get install phpmyadmin

在Ubuntu 18.04上为我修复了它。

其他回答

我尝试了以上所有的解决方案,但都不适合我。

试试这个:

安装所需的PHP版本(在我的例子中是7.0),然后在终端中键入

sudo update-alternatives --config php

输出如下所示:-

然后,只需输入选择号(在我的例子中是1),就可以切换到任何版本的PHP。

希望这可以帮助其他-:)

根据@jbator的回答,你可以编辑/usr/share/phpmyadmin/libraries/plugin_interface.lib.php并替换这一行:

if ($options != null && count($options) > 0) {

用这些句子:

if ($options != null &&
   ((is_array($options) || $options instanceof Countable) && count($options) > 0) ||
   (method_exists($options, 'getProperties') && $options->getProperties() != null && (is_array($options->getProperties()) || $options->getProperties() instanceof Countable) && count($options->getProperties()) > 0)) {

这样,导出的文件就不会是空的了。

以提升的权限打开/usr/share/phpmyadmin/sql.lib.php文件,并在函数PMA_isRememberSortingOrder()中编辑以下内容:

~第613行修复初始错误: 替换|| count($analyzed_sql_results['select_expr'] == 1) || (count($analyzed_sql_results['select_expr']) == 1) ~第614行来修复接下来可能出现的500错误: 替换& & ($ analyzed_sql_results [' select_expr '] [0 ] == '*'))) & & (analyzed_sql_results美元[' select_expr '] [0 ] == '*'))

重启Apache服务器:sudo service apache2 Restart。

在基于Ubuntu 18.04的Linux Mint 19.1上测试,使用PhpMyAdmin 4.6.6和PHP 7.2。

我看到你们都在编辑或更新我们的文件

对于那些想要自动更新的人,你可以使用我们的Ubuntu PPA

Sudo add-apt-repository ppa:phpmyadmin/ppa

对于Debian用户,您需要等待Debian的下一个版本或使用PPA

Ubuntu 20有phpMyAdmin 4.9或更高版本

我们的跟踪器上的Debian问题

我们跟踪器上的可数问题

TLDR 请更新到最新的4.9或5.0版本以解决此问题。

Works on UBUNTU 18.04 


Edit file: '/usr/share/phpmyadmin/libraries/sql.lib.php'
Replace: (count($analyzed_sql_results['select_expr'] == 1)
With:  ((count($analyzed_sql_results['select_expr']) == 1)

Restart the server
sudo service apache2 restart