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

Yesterday i installed PHP(7.2) and Mysql to my Ubuntu (16.04) PC. In Phpmyadmin i created and imported one database. when i try to open any tables in Database got following Error.

Warning in ./libraries/sql.lib.php#613

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

These error happens because there is version compatibility issue (phpMyAdmin v4.6.6 was not fully compatible with PHP 7.2).

how to resolve this Issue :

Update phpMyAdmin v4.6.6 to v4.8 version, which fixes these compatibility issues with PHP 7.2.

If you don’t want to update your phpMyAdmin Version following manual method available to fix these compatibility issues.

This error is produced by a line of code in /usr/share/phpmyadmin/libraries/sql.lib.php.

Open your Terminal

Before Edit this File Take Backup using following code

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

Edit sql.lib.php in nano

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

After loaded the file, Press CTRL + W and search for PMA_isRememberSortingOrder

inside this function there is no closing parenthesis after $analyzed_sql_results[‘select_expr’]. Making the below replacements to resolves this, then you will need to delete the last closing parenthesis on next line.

Replace

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;

with

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;

After changes made Save file and exit to file. (Press CTRL + x, press y and then press ENTER)

then restart the apache

sudo service apache2 restart

Now try to load your Database tables in phpMyAdmin, It’s works fine…

I hope these article will help to your problem….

You May Also Like

Leave a Reply

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