phpMyAdmin报错:Problem with phpMyAdmin and PHP 7.2: “Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”

phpmyadmin报错:

Some errors have been detected on the server! Please look at the bottom of this window.

[Ignore All] [Ignore]

This is the output when [users] table has been clicked: (but it shows the records at the top) this is found at the bottom===>

`Notice in ./libraries/dbi/DBIMysqli.class.php#522
Undefined offset: 245

Backtrace

./libraries/DatabaseInterface.class.php#2971: PMA_DBI_Mysqli->getFieldsMeta(object)
./libraries/sql.lib.php#1777: PMA_DatabaseInterface->getFieldsMeta(object)
./libraries/sql.lib.php#2107: PMA_getQueryResponseForResultsReturned(
object,
array,
string 'homestead',
string 'users',
NULL,
NULL,
object,
string './themes/pmahomme/img/',
string '28',
integer 25,
NULL,
NULL,
NULL,
NULL,
NULL,
string 'SELECT * FROM users',
NULL,
)
./libraries/sql.lib.php#1966: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'homestead',
string 'users',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM users',
NULL,
NULL,
)
./sql.php#216: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'homestead',
string 'users',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM users',
NULL,
NULL,
)
Notice in ./libraries/dbi/DBIMysqli.class.php#522
Undefined offset: 245

一般是版本问题,使用下面指令,查看当前phpmyadmin版本

sudo apt-cache show phpmyadmin

升级到4:4.6.6-4以上,一般不会再有问题,升级方法如下: 借助第三方源:

sudo add-apt-repository ppa:nijel/phpmyadmin
sudo apt-get update

I would use the personal archive for phpmyadmin if you really need the latest version. Mind though that there is a dependency (you need a newer php too):

 

如果以上方法不可以的话,使用下面的方法二:

修改 sql.lib.php 文件来修复这个问题,

首先,我们需要备份一下源文件:

sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak

然后编辑 sql.lib.php 文件

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

/   输入 select_expr 搜索到 代码

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

把它替换成

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

:wq   保存并退出

刷新一下你的phpmyadmin,应该可以了!

 

更多apt指令参看:Linux/Ubuntu: apt-cache命令的用法, apt-get apt-cache命令 使用

 

本文:phpmyadmin: Errors in MySQL tables: products, product_details and users (3 tables)