Written by , Updated on January 25, 2021

Today, I had installed PHP 7.3 and phpMyAdmin on Ubuntu 18.04 LTS system. I am using MariaDB as database server running on the same instance. When I tried to access data in tables using phpMyAdmin got the following error message on screen.

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

Issue with phpMyAdmin and PHP: Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable” General Articles phpMyAdmin

Solution:

It looks issue is due to older version of phpMyAdmin. The version of phpMyAdmin is older before the release of PHP 7.3 and it not properly compatible with that.

In order to resolve, we recommend to upgrade the phpMyAdmin version. But you can make changes in sql.lib.php to temporarily resolve this error.

  1. Make a backup of sql.lib.php
    sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak 
    
  2. Next, edit sql.lib.php in your favorite text editor:
    sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php 
    
  3. Press CTRL W and enter string (count($analyzed_sql_results['select_expr'] == 1) to search.

    Then, replace it with ((count($analyzed_sql_results['select_expr']) == 1)

    Issue with phpMyAdmin and PHP: Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable” General Articles phpMyAdmin

  4. Save file and exit. (Press CTRL X, press Y and then press ENTER).

All done. The error message should disappear now.