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

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?


当前回答

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

试试这个:

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

sudo update-alternatives --config php

输出如下所示:-

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

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

其他回答

打开/usr/share/phpmyadmin/libraries/sql.lib.php

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

按ctrl+w搜索(count($analyzed_sql_results['select_expr'] == 1)

Find: count($analyzed_sql_results['select_expr'] == 1)

Replace With:  (count($analyzed_sql_results['select_expr']) == 1)

重新启动服务器

 sudo service apache2 restart

此外,如果你仍然面临同样的问题,那么就做下面的事情。

打开/usr/share/phpmyadmin/libraries/plugin_interface.lib.php文件

sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php

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

Ctrl+w : if ($options != null && count($options) > 0) {

替换为以下代码

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

现在保存并重新启动服务器

sudo /etc/init.d/apache2 restart

嗨,下面绝对解决了我同样的问题(导入/导出等):

修复Phpmyadmin [plugin_interface.lib.php] + Php7.2 + Ubuntu 16.04的错误

所以…在ubuntu 18.04下,mysql, php7.2: 终端:

sudo gedit /usr/share/phpmyadmin/libraries/plugin_interface.lib.php

找到下面的行(ctrl+f):

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

我是在551行

并更改如下:

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

Ctrl +s保存更改

在终端:ctrl+c for get back prompt…

然后:sudo systemctl restart apache2

“我认为在新的php版本。它不能对unarray类型使用count()或sizeof()。强制参数数组是解决这个错误的简单方法,…”

感谢原作者解决问题!我试着分享它!

尝试在文件中替换此函数: /usr/share/phpmyadmin/libraries/sql.lib.php

function PMA_isRememberSortingOrder($analyzed_sql_results)
{
    return $GLOBALS['cfg']['RememberSorting']
        && ! ($analyzed_sql_results['is_count']
            || $analyzed_sql_results['is_export']
            || $analyzed_sql_results['is_func']
            || $analyzed_sql_results['is_analyse'])
        && $analyzed_sql_results['select_from']
        && ((empty($analyzed_sql_results['select_expr']))
            || (count($analyzed_sql_results['select_expr']) == 1)
                && ($analyzed_sql_results['select_expr'][0] == '*'))
        && count($analyzed_sql_results['select_tables']) == 1;
}
add-apt-repository ppa:phpmyadmin/ppa
apt-get clean
apt-get update
apt-get purge phpmyadmin
apt-get install phpmyadmin

在Ubuntu 18.04上为我修复了它。

is_可数函数(PHP 7 >= 7.3.0)

is_countable -验证变量的内容是可数值。

使用此函数的方法如下:

Is_countable ($var)

它将返回布尔值。欲了解更多详情,请访问http://php.net/manual/en/function.is-countable.php