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

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?


当前回答

编辑/usr/share/phpmyadmin/libraries/sql.lib.php文件

在错误上看到一个错误

./libraries/sql.lib.php#2038: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#1984: PMA_executeQueryAndGetQueryResponse(

转到这一行并删除函数调用。

这对我很管用。

其他回答

这在PHPMyAdmin的后续版本中得到了修复。Ubuntu 18.04.2的Ubuntu软件库的版本是4.6.6.5,而它们目前的版本是4.9.0.1。更新PHPMyAdmin安装可以解决这个问题,但是可能比仅仅编辑一行代码风险更大。下面是我在我的Ubuntu服务器上是怎么做的。对于所有操作系统,步骤本质上是相同的(只是路径不同)。

下载PHPMyAdmin。

wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.zip
unzip phpMyAdmin-4.9.0.1-all-languages.zip

备份旧的PHPMyAdmin安装。

cp -r /usr/share/phpmyadmin ~/phpmyadmin-backup

在旧的PHPMyAdmin上删除新的PHPMyAdmin

cd phpMyAdmin-4.9.0.1-all-languages
rm -r /usr/share/phpmyadmin/doc/html
cp -R * /usr/share/phpmyadmin/

验证它是否有效。如果没有,那么……您有备份,因此恢复它并手动编辑故障行。根据我个人的经验,我发现4.6.6.5版本不仅漏洞百出,而且与新的4.9.0.1相比速度也慢得令人难以置信。对于我认为是“WordPress”质量的东西来说,速度的提高是纯粹的魔法。

最简单的方法:

只需在终端的命令行下面运行这个,然后回到PhpMyAdmin。

sudo sed -i "s/|\s*\((count(\$analyzed_sql_results\['select_expr'\]\)/| (\1)/g" /usr/share/phpmyadmin/libraries/sql.lib.php

手动方法:

打开sql.lib.php文件

nano /usr/share/phpmyadmin/libraries/sql.lib.php

查找文件中的count($analyzed_sql_results['select_expr']代码。您可以在第613行得到这一点。您可以在下面看到错误的代码

|| (count($analyzed_sql_results['select_expr'] == 1)

把错误的代码替换成下面这个

|| ((count($analyzed_sql_results['select_expr']) == 1)

保存文件并进入PhpMyAdmin。

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

试试这个:

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

sudo update-alternatives --config php

输出如下所示:-

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

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

编辑/usr/share/phpmyadmin/libraries/sql.lib.php文件

在错误上看到一个错误

./libraries/sql.lib.php#2038: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#1984: PMA_executeQueryAndGetQueryResponse(

转到这一行并删除函数调用。

这对我很管用。

根据@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)) {

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