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命令 使用

 

如果还不行,那么第三种尝试:

 

Warning in ./libraries/plugin_interface.lib.php#532

count(): Parameter must be an array or an object that implements Countable

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 的 library 想要计算一些参数 $option,. At this line 532,  但是 $option需要是一个数组,但有时候可能是object,导致出错,我们找到它,修改一下就可以了。

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”
 

编辑文件 File /usr/share/phpmyadmin/libraries/plugin_interface.lib.php at line 532:

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

找到行 if ($options != null && count($options) > 0) { and replace count($options)with count((array)$options).

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”

 

重启Restart Apache Service:

sudo service apache2 restart

 

 

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

Loading

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.