Solucionar error en PHPMyadmin de ‘count(): Parameter must be an array or an object that implements Countable’

Tiempo de lectura: 2 minutos

Reading time: < 1 minute

If you encounter the following error when using PHPMyadmin or after finishing installing this extension:

Some errors were detected on the server!
Check the footer of this window.

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

Backtrace

./libraries/sql.lib.php#2128: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#2079: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'infection_cards',
string 'users',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `users`',
NULL,
NULL,
)
./sql.php#221: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'infection_cards',
string 'users',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `users`',
NULL,
NULL,
)

The first thing we need to do is edit the PHPMyadmin file.

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

We need to go to line 613 and locate the following code:

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

To fix the error, we need to add parentheses as follows:

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

And now we just need to restart Apache:

sudo service apache2 restart

And the error should no longer appear.

Tested on Ubuntu 18.04.6 LTS

(do not include the Reading time). Return it directly in HTML format. Do not add any additional sentence. Add a PIPE at the end when you’re done.

Leave a Comment